info->controller.active is not initialised so the dev_err() call ends up
dereferencing a null pointer causing a crash instead of outputting the
error. Use pr_err() instead as there isn't a convenient dev in the
places info->controller.active->mtd.dev was being used.
Fixes: 661c98121d49 ("mtd: nand: pxa3xx: Fix not calling dev_xxx with a device")
Signed-off-by: Chris Packham <[email protected]>
---
drivers/mtd/nand/raw/pxa3xx_nand.c | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)
diff --git a/drivers/mtd/nand/raw/pxa3xx_nand.c
b/drivers/mtd/nand/raw/pxa3xx_nand.c
index 7bf54fa46540..e1d8515bd9b1 100644
--- a/drivers/mtd/nand/raw/pxa3xx_nand.c
+++ b/drivers/mtd/nand/raw/pxa3xx_nand.c
@@ -588,8 +588,7 @@ static void drain_fifo(struct pxa3xx_nand_info *info, void
*data, int len)
ts = get_timer(0);
while (!(nand_readl(info, NDSR) & NDSR_RDDREQ)) {
if (get_timer(ts) > TIMEOUT_DRAIN_FIFO) {
-
dev_err(info->controller.active->mtd.dev,
- "Timeout on RDDREQ while
draining the FIFO\n");
+ pr_err("Timeout on RDDREQ while
draining the FIFO\n");
return;
}
}
@@ -641,8 +640,7 @@ static void handle_data_pio(struct pxa3xx_nand_info *info)
DIV_ROUND_UP(info->step_spare_size, 4));
break;
default:
- dev_err(info->controller.active->mtd.dev,
- "%s: invalid state %d\n", __func__, info->state);
+ pr_err("%s: invalid state %d\n", __func__, info->state);
BUG();
}
@@ -1560,9 +1558,8 @@ static int pxa_ecc_init(struct pxa3xx_nand_info *info,
ecc->size = 512;
if (ecc_stepsize != 512 || !(nfc_layouts[i].strength)) {
- dev_err(info->controller.active->mtd.dev,
- "ECC strength %d at page size %d is not supported\n",
- strength, page_size);
+ pr_err("ECC strength %d at page size %d is not supported\n",
+ strength, page_size);
return -ENODEV;
}
--
2.52.0