[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1540447621-22870-2-git-send-email-manish.narani@xilinx.com>
Date: Thu, 25 Oct 2018 11:36:56 +0530
From: Manish Narani <manish.narani@...inx.com>
To: <robh+dt@...nel.org>, <mark.rutland@....com>,
<michal.simek@...inx.com>, <bp@...en8.de>, <mchehab@...nel.org>,
<manish.narani@...inx.com>, <amit.kucheria@...aro.org>,
<sudeep.holla@....com>, <leoyang.li@....com>
CC: <devicetree@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
<linux-arm-kernel@...ts.infradead.org>,
<linux-edac@...r.kernel.org>
Subject: [PATCH v10 1/6] edac: synopsys: Add error handling for NULL in probe()
The function of_device_get_match_data() can return NULL in case of
error. Add error handling for the same in probe().
Signed-off-by: Manish Narani <manish.narani@...inx.com>
---
drivers/edac/synopsys_edac.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/edac/synopsys_edac.c b/drivers/edac/synopsys_edac.c
index 1c3795d..0005ef3 100644
--- a/drivers/edac/synopsys_edac.c
+++ b/drivers/edac/synopsys_edac.c
@@ -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;
--
2.1.1
Powered by blists - more mailing lists