Skip to content

Commit 6d55d31

Browse files
committed
Merge tag 'nand/for-6.7' into mtd/next
The raw NAND subsystem has, as usual, seen a bit of cleanup being done this cycle, typically return values of platform_get_irq() and devm_kasprintf(), plus structure annotations for sanitizers. There is also a better ECC check in the Arasan driver. This comes with smaller misc changes. In the SPI-NAND world there is now support for Foresee F35SQA002G, Winbond W25N and XTX XT26 chips. Signed-off-by: Miquel Raynal <[email protected]>
2 parents 3a8ab4a + 5a98596 commit 6d55d31

18 files changed

+305
-15
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -481,7 +481,7 @@ static int anfc_read_page_hw_ecc(struct nand_chip *chip, u8 *buf,
481481
}
482482

483483
bf = nand_check_erased_ecc_chunk(raw_buf, chip->ecc.size,
484-
NULL, 0, NULL, 0,
484+
anand->hw_ecc, chip->ecc.bytes, NULL, 0,
485485
chip->ecc.strength);
486486
if (bf > 0) {
487487
mtd->ecc_stats.corrected += bf;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -528,7 +528,7 @@ struct cdns_nand_chip {
528528
/* ECC strength index. */
529529
u8 corr_str_idx;
530530

531-
u8 cs[];
531+
u8 cs[] __counted_by(nsels);
532532
};
533533

534534
struct ecc_info {

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -619,6 +619,11 @@ static int ebu_nand_probe(struct platform_device *pdev)
619619
ebu_host->cs_num = cs;
620620

621621
resname = devm_kasprintf(dev, GFP_KERNEL, "nand_cs%d", cs);
622+
if (!resname) {
623+
ret = -ENOMEM;
624+
goto err_of_node_put;
625+
}
626+
622627
ebu_host->cs[cs].chipaddr = devm_platform_ioremap_resource_byname(pdev,
623628
resname);
624629
if (IS_ERR(ebu_host->cs[cs].chipaddr)) {
@@ -649,6 +654,11 @@ static int ebu_nand_probe(struct platform_device *pdev)
649654
}
650655

651656
resname = devm_kasprintf(dev, GFP_KERNEL, "addr_sel%d", cs);
657+
if (!resname) {
658+
ret = -ENOMEM;
659+
goto err_cleanup_dma;
660+
}
661+
652662
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, resname);
653663
if (!res) {
654664
ret = -EINVAL;

drivers/mtd/nand/raw/internals.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,6 @@ int nand_read_page_raw_notsupp(struct nand_chip *chip, u8 *buf,
106106
int oob_required, int page);
107107
int nand_write_page_raw_notsupp(struct nand_chip *chip, const u8 *buf,
108108
int oob_required, int page);
109-
int nand_exit_status_op(struct nand_chip *chip);
110109
int nand_read_param_page_op(struct nand_chip *chip, u8 page, void *buf,
111110
unsigned int len);
112111
void nand_decode_ext_id(struct nand_chip *chip);

drivers/mtd/nand/raw/meson_nand.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1134,6 +1134,9 @@ static int meson_nfc_clk_init(struct meson_nfc *nfc)
11341134
init.name = devm_kasprintf(nfc->dev,
11351135
GFP_KERNEL, "%s#div",
11361136
dev_name(nfc->dev));
1137+
if (!init.name)
1138+
return -ENOMEM;
1139+
11371140
init.ops = &clk_divider_ops;
11381141
nfc_divider_parent_data[0].fw_name = "device";
11391142
init.parent_data = nfc_divider_parent_data;

drivers/mtd/nand/raw/mtk_nand.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ struct mtk_nfc_nand_chip {
130130
u32 spare_per_sector;
131131

132132
int nsels;
133-
u8 sels[];
133+
u8 sels[] __counted_by(nsels);
134134
/* nothing after this field */
135135
};
136136

drivers/mtd/nand/raw/nand_base.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@
4242
#include <linux/io.h>
4343
#include <linux/mtd/partitions.h>
4444
#include <linux/of.h>
45-
#include <linux/of_gpio.h>
4645
#include <linux/gpio/consumer.h>
4746

4847
#include "internals.h"

drivers/mtd/nand/raw/omap2.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1881,8 +1881,8 @@ static int omap_nand_attach_chip(struct nand_chip *chip)
18811881

18821882
case NAND_OMAP_PREFETCH_IRQ:
18831883
info->gpmc_irq_fifo = platform_get_irq(info->pdev, 0);
1884-
if (info->gpmc_irq_fifo <= 0)
1885-
return -ENODEV;
1884+
if (info->gpmc_irq_fifo < 0)
1885+
return info->gpmc_irq_fifo;
18861886
err = devm_request_irq(dev, info->gpmc_irq_fifo,
18871887
omap_nand_irq, IRQF_SHARED,
18881888
"gpmc-nand-fifo", info);
@@ -1894,8 +1894,8 @@ static int omap_nand_attach_chip(struct nand_chip *chip)
18941894
}
18951895

18961896
info->gpmc_irq_count = platform_get_irq(info->pdev, 1);
1897-
if (info->gpmc_irq_count <= 0)
1898-
return -ENODEV;
1897+
if (info->gpmc_irq_count < 0)
1898+
return info->gpmc_irq_count;
18991899
err = devm_request_irq(dev, info->gpmc_irq_count,
19001900
omap_nand_irq, IRQF_SHARED,
19011901
"gpmc-nand-count", info);

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -158,8 +158,7 @@ struct rk_nfc_nand_chip {
158158
u32 timing;
159159

160160
u8 nsels;
161-
u8 sels[];
162-
/* Nothing after this field. */
161+
u8 sels[] __counted_by(nsels);
163162
};
164163

165164
struct rk_nfc {
@@ -1119,7 +1118,7 @@ static int rk_nfc_nand_chip_init(struct device *dev, struct rk_nfc *nfc,
11191118
return -EINVAL;
11201119
}
11211120

1122-
rknand = devm_kzalloc(dev, sizeof(*rknand) + nsels * sizeof(u8),
1121+
rknand = devm_kzalloc(dev, struct_size(rknand, sels, nsels),
11231122
GFP_KERNEL);
11241123
if (!rknand)
11251124
return -ENOMEM;

drivers/mtd/nand/raw/sh_flctl.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1215,14 +1215,15 @@ static void flctl_remove(struct platform_device *pdev)
12151215
}
12161216

12171217
static struct platform_driver flctl_driver = {
1218+
.probe = flctl_probe,
12181219
.remove_new = flctl_remove,
12191220
.driver = {
12201221
.name = "sh_flctl",
12211222
.of_match_table = of_flctl_match,
12221223
},
12231224
};
12241225

1225-
module_platform_driver_probe(flctl_driver, flctl_probe);
1226+
module_platform_driver(flctl_driver);
12261227

12271228
MODULE_LICENSE("GPL v2");
12281229
MODULE_AUTHOR("Yoshihiro Shimoda");

0 commit comments

Comments
 (0)