[PATCH next] pmdomain: thead: Fix error pointer vs NULL bug in th1520_pd_reboot_init()
Ulf Hansson
ulf.hansson at linaro.org
Fri Sep 26 05:51:43 PDT 2025
On Fri, 26 Sept 2025 at 06:03, Dan Carpenter <dan.carpenter at linaro.org> wrote:
>
> 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 at linaro.org>
Applied for next, thanks!
Kind regards
Uffe
> ---
> drivers/pmdomain/thead/th1520-pm-domains.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/pmdomain/thead/th1520-pm-domains.c b/drivers/pmdomain/thead/th1520-pm-domains.c
> index 5213994101a5..d7cb9633c7c8 100644
> --- a/drivers/pmdomain/thead/th1520-pm-domains.c
> +++ b/drivers/pmdomain/thead/th1520-pm-domains.c
> @@ -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)
> --
> 2.51.0
>
More information about the linux-riscv
mailing list