summaryrefslogtreecommitdiffstats
path: root/drivers/mtd/nand/nand_mxs.c
diff options
context:
space:
mode:
authorAhmad Fatoum <a.fatoum@pengutronix.de>2020-10-07 11:50:56 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2020-10-09 08:48:02 +0200
commit48032a50be663f003ec3af5d27042e1de7992f47 (patch)
tree50989bc411a6065b38df53cb28b95d7aa83fc7be /drivers/mtd/nand/nand_mxs.c
parent63d7846084a20f21a5faa2baf7dcddcbbdab3dfb (diff)
downloadbarebox-48032a50be663f003ec3af5d27042e1de7992f47.tar.gz
barebox-48032a50be663f003ec3af5d27042e1de7992f47.tar.xz
mtd: nand-mxs: fix out-of-bounds write on 64-bit SoCs
Probing the nand_mxs device driver on 64 bit systems invokes undefined behavior, because of an errant cast. Fix this. No change of behavior for 32-bit SoCs intended. On error, type == 0 == GPMI_MXS as it used to. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers/mtd/nand/nand_mxs.c')
-rw-r--r--drivers/mtd/nand/nand_mxs.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/drivers/mtd/nand/nand_mxs.c b/drivers/mtd/nand/nand_mxs.c
index 36b6e7ac22..e2b6e21620 100644
--- a/drivers/mtd/nand/nand_mxs.c
+++ b/drivers/mtd/nand/nand_mxs.c
@@ -2145,9 +2145,7 @@ static int mxs_nand_probe(struct device_d *dev)
if (mxs_nand_mtd)
return -EBUSY;
- err = dev_get_drvdata(dev, (const void **)&type);
- if (err)
- type = GPMI_MXS;
+ type = (enum gpmi_type)device_get_match_data(dev);
nand_info = kzalloc(sizeof(struct mxs_nand_info), GFP_KERNEL);
if (!nand_info) {