Skip to content

Commit 9b2ffa6

Browse files
committed
Merge tag 'mtd/fixes-for-6.13-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux
Pull mtd fixes from Miquel Raynal: "Four minor fixes for NAND controller drivers (cleanup path, double actions, and W=1 warning) as well as a cast to avoid overflows in an mtd device driver" * tag 'mtd/fixes-for-6.13-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux: mtd: rawnand: omap2: Fix build warnings with W=1 mtd: rawnand: arasan: Fix missing de-registration of NAND mtd: rawnand: arasan: Fix double assertion of chip-select mtd: diskonchip: Cast an operand to prevent potential overflow mtd: rawnand: fix double free in atmel_pmecc_create_user()
2 parents ef49c46 + 140054a commit 9b2ffa6

File tree

4 files changed

+27
-6
lines changed

4 files changed

+27
-6
lines changed

drivers/mtd/nand/raw/arasan-nand-controller.c

+9-2
Original file line numberDiff line numberDiff line change
@@ -1409,8 +1409,8 @@ static int anfc_parse_cs(struct arasan_nfc *nfc)
14091409
* case, the "not" chosen CS is assigned to nfc->spare_cs and selected
14101410
* whenever a GPIO CS must be asserted.
14111411
*/
1412-
if (nfc->cs_array && nfc->ncs > 2) {
1413-
if (!nfc->cs_array[0] && !nfc->cs_array[1]) {
1412+
if (nfc->cs_array) {
1413+
if (nfc->ncs > 2 && !nfc->cs_array[0] && !nfc->cs_array[1]) {
14141414
dev_err(nfc->dev,
14151415
"Assign a single native CS when using GPIOs\n");
14161416
return -EINVAL;
@@ -1478,8 +1478,15 @@ static int anfc_probe(struct platform_device *pdev)
14781478

14791479
static void anfc_remove(struct platform_device *pdev)
14801480
{
1481+
int i;
14811482
struct arasan_nfc *nfc = platform_get_drvdata(pdev);
14821483

1484+
for (i = 0; i < nfc->ncs; i++) {
1485+
if (nfc->cs_array[i]) {
1486+
gpiod_put(nfc->cs_array[i]);
1487+
}
1488+
}
1489+
14831490
anfc_chips_cleanup(nfc);
14841491
}
14851492

drivers/mtd/nand/raw/atmel/pmecc.c

+1-3
Original file line numberDiff line numberDiff line change
@@ -380,10 +380,8 @@ atmel_pmecc_create_user(struct atmel_pmecc *pmecc,
380380
user->delta = user->dmu + req->ecc.strength + 1;
381381

382382
gf_tables = atmel_pmecc_get_gf_tables(req);
383-
if (IS_ERR(gf_tables)) {
384-
kfree(user);
383+
if (IS_ERR(gf_tables))
385384
return ERR_CAST(gf_tables);
386-
}
387385

388386
user->gf_tables = gf_tables;
389387

drivers/mtd/nand/raw/diskonchip.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -1098,7 +1098,7 @@ static inline int __init inftl_partscan(struct mtd_info *mtd, struct mtd_partiti
10981098
(i == 0) && (ip->firstUnit > 0)) {
10991099
parts[0].name = " DiskOnChip IPL / Media Header partition";
11001100
parts[0].offset = 0;
1101-
parts[0].size = mtd->erasesize * ip->firstUnit;
1101+
parts[0].size = (uint64_t)mtd->erasesize * ip->firstUnit;
11021102
numparts = 1;
11031103
}
11041104

drivers/mtd/nand/raw/omap2.c

+16
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,10 @@ static int omap_prefetch_reset(int cs, struct omap_nand_info *info)
254254

255255
/**
256256
* omap_nand_data_in_pref - NAND data in using prefetch engine
257+
* @chip: NAND chip
258+
* @buf: output buffer where NAND data is placed into
259+
* @len: length of transfer
260+
* @force_8bit: force 8-bit transfers
257261
*/
258262
static void omap_nand_data_in_pref(struct nand_chip *chip, void *buf,
259263
unsigned int len, bool force_8bit)
@@ -297,6 +301,10 @@ static void omap_nand_data_in_pref(struct nand_chip *chip, void *buf,
297301

298302
/**
299303
* omap_nand_data_out_pref - NAND data out using Write Posting engine
304+
* @chip: NAND chip
305+
* @buf: input buffer that is sent to NAND
306+
* @len: length of transfer
307+
* @force_8bit: force 8-bit transfers
300308
*/
301309
static void omap_nand_data_out_pref(struct nand_chip *chip,
302310
const void *buf, unsigned int len,
@@ -440,6 +448,10 @@ static inline int omap_nand_dma_transfer(struct nand_chip *chip,
440448

441449
/**
442450
* omap_nand_data_in_dma_pref - NAND data in using DMA and Prefetch
451+
* @chip: NAND chip
452+
* @buf: output buffer where NAND data is placed into
453+
* @len: length of transfer
454+
* @force_8bit: force 8-bit transfers
443455
*/
444456
static void omap_nand_data_in_dma_pref(struct nand_chip *chip, void *buf,
445457
unsigned int len, bool force_8bit)
@@ -460,6 +472,10 @@ static void omap_nand_data_in_dma_pref(struct nand_chip *chip, void *buf,
460472

461473
/**
462474
* omap_nand_data_out_dma_pref - NAND data out using DMA and write posting
475+
* @chip: NAND chip
476+
* @buf: input buffer that is sent to NAND
477+
* @len: length of transfer
478+
* @force_8bit: force 8-bit transfers
463479
*/
464480
static void omap_nand_data_out_dma_pref(struct nand_chip *chip,
465481
const void *buf, unsigned int len,

0 commit comments

Comments
 (0)