From: Kaushlendra Kumar <kaushlendra.kumar@intel.com>
To: myungjoo.ham@samsung.com, kyungmin.park@samsung.com,
cw00.choi@samsung.com
Cc: linux-pm@vger.kernel.org,
Kaushlendra Kumar <kaushlendra.kumar@intel.com>
Subject: [PATCH] PM / devfreq: Fix error code propagation in devm_devfreq_event_add_edev()
Date: Mon, 8 Sep 2025 09:54:02 +0530 [thread overview]
Message-ID: <20250908042402.3404408-1-kaushlendra.kumar@intel.com> (raw)
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
reply other threads:[~2025-09-08 4:25 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250908042402.3404408-1-kaushlendra.kumar@intel.com \
--to=kaushlendra.kumar@intel.com \
--cc=cw00.choi@samsung.com \
--cc=kyungmin.park@samsung.com \
--cc=linux-pm@vger.kernel.org \
--cc=myungjoo.ham@samsung.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox