public inbox for linux-pm@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] PM / devfreq: Fix error code propagation in devm_devfreq_event_add_edev()
@ 2025-09-08  4:24 Kaushlendra Kumar
  0 siblings, 0 replies; only message in thread
From: Kaushlendra Kumar @ 2025-09-08  4:24 UTC (permalink / raw)
  To: myungjoo.ham, kyungmin.park, cw00.choi; +Cc: linux-pm, Kaushlendra Kumar

Fix incorrect error code return in devm_devfreq_event_add_edev() when
devfreq_event_add_edev() fails. The function was unconditionally
returning -ENOMEM regardless of the actual error returned by
devfreq_event_add_edev().

The devfreq_event_add_edev() function can fail for various reasons:
- Invalid parameters (-EINVAL)
- Memory allocation failure (-ENOMEM)
- Device registration failure (various error codes)

This change ensures that callers receive the accurate error information,
improving error handling and debugging capabilities in the devfreq
event subsystem.

Signed-off-by: Kaushlendra Kumar <kaushlendra.kumar@intel.com>
---
 drivers/devfreq/devfreq-event.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/devfreq/devfreq-event.c b/drivers/devfreq/devfreq-event.c
index 70219099c604..32194c60dfc7 100644
--- a/drivers/devfreq/devfreq-event.c
+++ b/drivers/devfreq/devfreq-event.c
@@ -403,7 +403,7 @@ struct devfreq_event_dev *devm_devfreq_event_add_edev(struct device *dev,
 	edev = devfreq_event_add_edev(dev, desc);
 	if (IS_ERR(edev)) {
 		devres_free(ptr);
-		return ERR_PTR(-ENOMEM);
+		return edev;
 	}
 
 	*ptr = edev;
-- 
2.34.1


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2025-09-08  4:25 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-08  4:24 [PATCH] PM / devfreq: Fix error code propagation in devm_devfreq_event_add_edev() Kaushlendra Kumar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox