hc
2023-12-11 d2ccde1c8e90d38cee87a1b0309ad2827f3fd30d
kernel/drivers/mtd/chips/gen_probe.c
....@@ -20,7 +20,7 @@
2020
2121 struct mtd_info *mtd_do_chip_probe(struct map_info *map, struct chip_probe *cp)
2222 {
23
- struct mtd_info *mtd = NULL;
23
+ struct mtd_info *mtd;
2424 struct cfi_private *cfi;
2525
2626 /* First probe the map to see if we have CFI stuff there. */
....@@ -135,7 +135,7 @@
135135 * our caller, and copy the appropriate data into them.
136136 */
137137
138
- retcfi = kmalloc(sizeof(struct cfi_private) + cfi.numchips * sizeof(struct flchip), GFP_KERNEL);
138
+ retcfi = kmalloc(struct_size(retcfi, chips, cfi.numchips), GFP_KERNEL);
139139
140140 if (!retcfi) {
141141 kfree(cfi.cfiq);