diff options
author | Jiasheng Jiang <jiasheng@iscas.ac.cn> | 2021-12-20 11:38:11 +0300 |
---|---|---|
committer | Sebastian Reichel <sre@kernel.org> | 2022-01-03 20:30:21 +0300 |
commit | 1c1348bf056dee665760a3bd1cd30b0be7554fc2 (patch) | |
tree | b3efab16ef53816dda65a6ac0683f4a04707f7b4 /drivers/power | |
parent | 9652c02428f3992129b73321fee32fe60b77c90f (diff) | |
download | linux-1c1348bf056dee665760a3bd1cd30b0be7554fc2.tar.xz |
power: reset: mt6397: Check for null res pointer
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>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Diffstat (limited to 'drivers/power')
-rw-r--r-- | drivers/power/reset/mt6323-poweroff.c | 3 |
1 files changed, 3 insertions, 0 deletions
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; |