kernel-janitors.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH next] pmdomain: thead: Fix error pointer vs NULL bug in th1520_pd_reboot_init()
@ 2025-09-26  4:03 Dan Carpenter
  2025-09-26  6:59 ` Icenowy Zheng
  2025-09-26 12:51 ` Ulf Hansson
  0 siblings, 2 replies; 3+ messages in thread
From: Dan Carpenter @ 2025-09-26  4:03 UTC (permalink / raw)
  To: Icenowy Zheng
  Cc: Drew Fustini, Guo Ren, Fu Wei, Ulf Hansson, linux-riscv, linux-pm,
	linux-kernel, kernel-janitors

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>
---
 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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-09-26 12:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-26  4:03 [PATCH next] pmdomain: thead: Fix error pointer vs NULL bug in th1520_pd_reboot_init() Dan Carpenter
2025-09-26  6:59 ` Icenowy Zheng
2025-09-26 12:51 ` Ulf Hansson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).