@@ -1596,6 +1596,10 @@ static int __init mxcnd_probe_dt(struct mxc_nand_host *host)
if (!np)
return 1;
+ if (!of_id) {
+ dev_err(host->dev, "Error: No device match found\n");
+ return -ENODEV;
+ }
host->devtype_data = of_id->data;
return 0;
@@ -674,6 +674,10 @@ static int vf610_nfc_probe(struct platform_device *pdev)
}
of_id = of_match_device(vf610_nfc_dt_ids, &pdev->dev);
+ if (!of_id) {
+ dev_err(&pdev->dev, "Error: No device match found\n");
+ return -ENODEV;
+ }
nfc->variant = (enum vf610_nfc_variant)of_id->data;
for_each_available_child_of_node(nfc->dev->of_node, child) {
of_match_device could return NULL, and so can cause a NULL pointer dereference later. Signed-off-by: Shailendra Verma <shailendra.v@samsung.com> --- drivers/mtd/nand/mxc_nand.c | 4 ++++ drivers/mtd/nand/vf610_nfc.c | 4 ++++ 2 files changed, 8 insertions(+)