All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] rtc: mt6397: Check for null res pointer
@ 2021-12-20  8:38 ` Jiasheng Jiang
  0 siblings, 0 replies; 6+ messages in thread
From: Jiasheng Jiang @ 2021-12-20  8:38 UTC (permalink / raw)
  To: sean.wang, sre, matthias.bgg
  Cc: linux-pm, linux-arm-kernel, linux-mediatek, linux-kernel, Jiasheng Jiang

The return value of platform_get_resource() needs to be checked.
To avoid use of error pointer in case that there is no suitable
resource.

Fixes: d28c74c10751 ("power: reset: add driver for mt6323 poweroff")
Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
---
 drivers/power/reset/mt6323-poweroff.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/power/reset/mt6323-poweroff.c b/drivers/power/reset/mt6323-poweroff.c
index 0532803e6cbc..d90e76fcb938 100644
--- a/drivers/power/reset/mt6323-poweroff.c
+++ b/drivers/power/reset/mt6323-poweroff.c
@@ -57,6 +57,9 @@ static int mt6323_pwrc_probe(struct platform_device *pdev)
 		return -ENOMEM;
 
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+	if (!res)
+		return -EINVAL;
+
 	pwrc->base = res->start;
 	pwrc->regmap = mt6397_chip->regmap;
 	pwrc->dev = &pdev->dev;
-- 
2.25.1


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

end of thread, other threads:[~2022-01-03 17:41 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-20  8:38 [PATCH] rtc: mt6397: Check for null res pointer Jiasheng Jiang
2021-12-20  8:38 ` Jiasheng Jiang
2021-12-20  8:38 ` Jiasheng Jiang
2022-01-03 17:39 ` Sebastian Reichel
2022-01-03 17:39   ` Sebastian Reichel
2022-01-03 17:39   ` Sebastian Reichel

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.