[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-id: <1485752405-29885-1-git-send-email-shailendra.v@samsung.com>
Date: Mon, 30 Jan 2017 10:30:05 +0530
From: Shailendra Verma <shailendra.v@...sung.com>
To: Alexandre Belloni <alexandre.belloni@...e-electrons.com>,
Paul Gortmaker <paul.gortmaker@...driver.com>,
Nicolas Ferre <nicolas.ferre@...el.com>,
LABBE Corentin <clabbe.montjoie@...il.com>,
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] Memory - Fix possible NULL derefrence.
of_device_get_match_data could return NULL, and so can cause
a NULL pointer dereference later.
Signed-off-by: Shailendra Verma <shailendra.v@...sung.com>
---
drivers/memory/atmel-sdramc.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/memory/atmel-sdramc.c b/drivers/memory/atmel-sdramc.c
index 12080b0..cb63fbe 100644
--- a/drivers/memory/atmel-sdramc.c
+++ b/drivers/memory/atmel-sdramc.c
@@ -57,6 +57,10 @@ static int atmel_ramc_probe(struct platform_device *pdev)
struct clk *clk;
caps = of_device_get_match_data(&pdev->dev);
+ if (!caps) {
+ dev_err(&pdev->dev, "no device match found\n");
+ return -ENODEV;
+ }
if (caps->has_ddrck) {
clk = devm_clk_get(&pdev->dev, "ddrck");
--
1.7.9.5
Powered by blists - more mailing lists