diff options
author | Aditya Pakki <pakki001@umn.edu> | 2019-03-18 18:24:34 -0500 |
---|---|---|
committer | Miquel Raynal <miquel.raynal@bootlin.com> | 2019-04-08 10:21:07 +0200 |
commit | 6f0ce4dfc5a35bcb21f26d5347f4797fdde52810 (patch) | |
tree | 7eebacca341754bd163d7b235cd74ad793495153 /drivers/mtd/nand/raw | |
parent | e84950691bf7aec716ae671a8b6e82322df6d54a (diff) |
mtd: rawnand: vf610: Avoid a potential NULL pointer dereference
of_match_device can return NULL if there is no matching device. Avoid
a potential NULL pointer dereference by checking for the return value
and passing the error upstream.
Signed-off-by: Aditya Pakki <pakki001@umn.edu>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Diffstat (limited to 'drivers/mtd/nand/raw')
-rw-r--r-- | drivers/mtd/nand/raw/vf610_nfc.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/mtd/nand/raw/vf610_nfc.c b/drivers/mtd/nand/raw/vf610_nfc.c index a662ca1970e5..6d43ddb3332f 100644 --- a/drivers/mtd/nand/raw/vf610_nfc.c +++ b/drivers/mtd/nand/raw/vf610_nfc.c @@ -850,6 +850,9 @@ static int vf610_nfc_probe(struct platform_device *pdev) } of_id = of_match_device(vf610_nfc_dt_ids, &pdev->dev); + if (!of_id) + return -ENODEV; + nfc->variant = (enum vf610_nfc_variant)of_id->data; for_each_available_child_of_node(nfc->dev->of_node, child) { |