]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
pmdomain: thead: Fix error pointer vs NULL bug in th1520_pd_reboot_init()
authorDan Carpenter <dan.carpenter@linaro.org>
Fri, 26 Sep 2025 04:03:29 +0000 (07:03 +0300)
committerUlf Hansson <ulf.hansson@linaro.org>
Fri, 26 Sep 2025 12:50:20 +0000 (14:50 +0200)
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>
drivers/pmdomain/thead/th1520-pm-domains.c

index 5213994101a59134a3c927fd4ee7f9733c574469..d7cb9633c7c8a3ae45c9063a1f1b888db2899af7 100644 (file)
@@ -179,8 +179,10 @@ static int th1520_pd_reboot_init(struct device *dev,
        struct auxiliary_device *adev;
 
        adev = devm_auxiliary_device_create(dev, "reboot", aon_chan);
+       if (!adev)
+               return -ENODEV;
 
-       return PTR_ERR_OR_ZERO(adev);
+       return 0;
 }
 
 static int th1520_pd_probe(struct platform_device *pdev)