Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: 64581f41f4c4 ("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>

authored by

Dan Carpenter and committed by
Ulf Hansson
bbc31108 de023206

+3 -1
+3 -1
drivers/pmdomain/thead/th1520-pm-domains.c
··· 179 179 struct auxiliary_device *adev; 180 180 181 181 adev = devm_auxiliary_device_create(dev, "reboot", aon_chan); 182 + if (!adev) 183 + return -ENODEV; 182 184 183 - return PTR_ERR_OR_ZERO(adev); 185 + return 0; 184 186 } 185 187 186 188 static int th1520_pd_probe(struct platform_device *pdev)