[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-id: <1485752113-29581-1-git-send-email-shailendra.v@samsung.com>
Date: Mon, 30 Jan 2017 10:25:13 +0530
From: Shailendra Verma <shailendra.v@...sung.com>
To: Mark Brown <broonie@...nel.org>, linux-spi@...r.kernel.org,
linux-kernel@...r.kernel.org, p.shailesh@...sung.com,
ashish.kalra@...sung.com,
Shailendra Verma <shailendra.v@...sung.com>,
Shailendra Verma <shailendra.capricorn@...il.com>
Subject: [PATCH] spi - Fix possible NULL derefrence.
of_match_device could return NULL, and so can cause a NULL
pointer dereference later.
Signed-off-by: Shailendra Verma <shailendra.v@...sung.com>
---
drivers/spi/spi-mxs.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/spi/spi-mxs.c b/drivers/spi/spi-mxs.c
index 5b0e9a3..c3aea7e 100644
--- a/drivers/spi/spi-mxs.c
+++ b/drivers/spi/spi-mxs.c
@@ -470,6 +470,11 @@ static int mxs_spi_probe(struct platform_device *pdev)
*/
const int clk_freq_default = 160000000;
+ if (!of_id) {
+ dev_err(&pdev->dev, "Error: No device match found\n");
+ return -ENODEV;
+ }
+
iores = platform_get_resource(pdev, IORESOURCE_MEM, 0);
irq_err = platform_get_irq(pdev, 0);
if (irq_err < 0)
--
1.7.9.5
Powered by blists - more mailing lists