Commit 84de0b49 authored by Manish Narani's avatar Manish Narani Committed by Borislav Petkov

EDAC, synopsys: Add error handling for the of_device_get_match_data() result

The function of_device_get_match_data() can return NULL in case of
error. Add error handling for the same in the mc_probe() function.
Signed-off-by: default avatarManish Narani <manish.narani@xilinx.com>
Signed-off-by: default avatarBorislav Petkov <bp@suse.de>
CC: Mauro Carvalho Chehab <mchehab@kernel.org>
CC: Michal Simek <michal.simek@xilinx.com>
CC: amit.kucheria@linaro.org
CC: devicetree@vger.kernel.org
CC: leoyang.li@nxp.com
CC: linux-arm-kernel@lists.infradead.org
CC: linux-edac <linux-edac@vger.kernel.org>
CC: mark.rutland@arm.com
CC: robh+dt@kernel.org
CC: sudeep.holla@arm.com
Link: http://lkml.kernel.org/r/1540447621-22870-2-git-send-email-manish.narani@xilinx.com
parent 3d02a897
...@@ -477,6 +477,9 @@ static int mc_probe(struct platform_device *pdev) ...@@ -477,6 +477,9 @@ static int mc_probe(struct platform_device *pdev)
return PTR_ERR(baseaddr); return PTR_ERR(baseaddr);
p_data = of_device_get_match_data(&pdev->dev); p_data = of_device_get_match_data(&pdev->dev);
if (!p_data)
return -ENODEV;
if (!p_data->get_ecc_state(baseaddr)) { if (!p_data->get_ecc_state(baseaddr)) {
edac_printk(KERN_INFO, EDAC_MC, "ECC not enabled\n"); edac_printk(KERN_INFO, EDAC_MC, "ECC not enabled\n");
return -ENXIO; return -ENXIO;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment