* [PATCH] rtc: mt6397: Check for null res pointer
@ 2021-12-20 8:38 Jiasheng Jiang
2022-01-03 17:39 ` Sebastian Reichel
0 siblings, 1 reply; 2+ 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] 2+ messages in thread
* Re: [PATCH] rtc: mt6397: Check for null res pointer
2021-12-20 8:38 [PATCH] rtc: mt6397: Check for null res pointer Jiasheng Jiang
@ 2022-01-03 17:39 ` Sebastian Reichel
0 siblings, 0 replies; 2+ messages in thread
From: Sebastian Reichel @ 2022-01-03 17:39 UTC (permalink / raw)
To: Jiasheng Jiang
Cc: sean.wang, matthias.bgg, linux-pm, linux-arm-kernel,
linux-mediatek, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 1080 bytes --]
Hi,
On Mon, Dec 20, 2021 at 04:38:11PM +0800, Jiasheng Jiang wrote:
> 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>
> ---
Thanks, I fixed the subject and queued the patch.
-- Sebastian
> 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
>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-01-03 17:40 UTC | newest]
Thread overview: 2+ 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
2022-01-03 17:39 ` Sebastian Reichel
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).