Skip to content

Commit

Permalink
EDAC, synopsys: Add error handling for the of_device_get_match_data()…
Browse files Browse the repository at this point in the history
… 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: Manish Narani <manish.narani@xilinx.com>
Signed-off-by: Borislav 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
  • Loading branch information
Manish Narani authored and Borislav Petkov committed Nov 5, 2018
1 parent 3d02a89 commit 84de0b4
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions drivers/edac/synopsys_edac.c
Original file line number Diff line number Diff line change
@@ -477,6 +477,9 @@ static int mc_probe(struct platform_device *pdev)
return PTR_ERR(baseaddr);

p_data = of_device_get_match_data(&pdev->dev);
if (!p_data)
return -ENODEV;

if (!p_data->get_ecc_state(baseaddr)) {
edac_printk(KERN_INFO, EDAC_MC, "ECC not enabled\n");
return -ENXIO;

0 comments on commit 84de0b4

Please sign in to comment.