Skip to content

Commit

Permalink
power: reset: mt6397: Check for null res pointer
Browse files Browse the repository at this point in the history
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: d28c74c ("power: reset: add driver for mt6323 poweroff")
Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
  • Loading branch information
Jiasheng Jiang authored and Sebastian Reichel committed Jan 3, 2022
1 parent 9652c02 commit 1c1348b
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions drivers/power/reset/mt6323-poweroff.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 1c1348b

Please sign in to comment.