Skip to content

Commit bbc3110

Browse files
Dan Carpenterstorulf
authored andcommitted
pmdomain: thead: Fix error pointer vs NULL bug in th1520_pd_reboot_init()
The devm_auxiliary_device_create() returns NULL on error. It never returns error pointers. Using PTR_ERR_OR_ZERO() here means the function always returns success. Replace the PTR_ERR_OR_ZERO() call check with a NULL check. Fixes: 64581f4 ("pmdomain: thead: create auxiliary device for rebooting") Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org> Acked-by: Icenowy Zheng <uwu@icenowy.me> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
1 parent de02320 commit bbc3110

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

drivers/pmdomain/thead/th1520-pm-domains.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,8 +179,10 @@ static int th1520_pd_reboot_init(struct device *dev,
179179
struct auxiliary_device *adev;
180180

181181
adev = devm_auxiliary_device_create(dev, "reboot", aon_chan);
182+
if (!adev)
183+
return -ENODEV;
182184

183-
return PTR_ERR_OR_ZERO(adev);
185+
return 0;
184186
}
185187

186188
static int th1520_pd_probe(struct platform_device *pdev)

0 commit comments

Comments
 (0)