linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] memory: atmel-sdramc: check of_device_get_match_data() return value
@ 2021-04-07 15:44 Krzysztof Kozlowski
  2021-04-07 16:19 ` Alexandre Belloni
  0 siblings, 1 reply; 3+ messages in thread
From: Krzysztof Kozlowski @ 2021-04-07 15:44 UTC (permalink / raw)
  To: Krzysztof Kozlowski, Nicolas Ferre, Alexandre Belloni,
	Ludovic Desroches, linux-kernel, linux-arm-kernel

If the driver is probed, the of_device_get_match_data() should not
return NULL, however for sanity check its return value.

Addresses-Coverity: Dereference null return value
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
---
 drivers/memory/atmel-sdramc.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/memory/atmel-sdramc.c b/drivers/memory/atmel-sdramc.c
index 9c49d00c2a96..e09b2617f63d 100644
--- a/drivers/memory/atmel-sdramc.c
+++ b/drivers/memory/atmel-sdramc.c
@@ -45,6 +45,8 @@ static int atmel_ramc_probe(struct platform_device *pdev)
 	struct clk *clk;
 
 	caps = of_device_get_match_data(&pdev->dev);
+	if (!caps)
+		return -EINVAL;
 
 	if (caps->has_ddrck) {
 		clk = devm_clk_get(&pdev->dev, "ddrck");
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-04-07 16:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-07 15:44 [PATCH] memory: atmel-sdramc: check of_device_get_match_data() return value Krzysztof Kozlowski
2021-04-07 16:19 ` Alexandre Belloni
2021-04-07 16:55   ` Krzysztof Kozlowski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).