From: Haris Wu <bymark256@gmail.com>
To: andersson@kernel.org, konradybcio@kernel.org
Cc: linux-arm-msm@vger.kernel.org, Haris Wu <bymark256@gmail.com>
Subject: [PATCH] soc: qcom: aoss: avoid registering cooling for NULL cdev
Date: Fri, 12 Dec 2025 10:36:10 +0800 [thread overview]
Message-ID: <20251212023610.13918-1-bymark256@gmail.com> (raw)
When PTR_ERR_OR_ZERO points to NULL, it returns 0. In this case, if
(ret) does not meet expectations. Now, qmp_cooling_device_add returns
NODEV for both failure and NULL, and returns 0 for success.
Signed-off-by: Haris Wu <bymark256@gmail.com>
---
drivers/soc/qcom/qcom_aoss.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/soc/qcom/qcom_aoss.c b/drivers/soc/qcom/qcom_aoss.c
index a543ab9be..ac411343d 100644
--- a/drivers/soc/qcom/qcom_aoss.c
+++ b/drivers/soc/qcom/qcom_aoss.c
@@ -386,11 +386,13 @@ static int qmp_cooling_device_add(struct qmp *qmp,
cdev_name,
qmp_cdev, &qmp_cooling_device_ops);
- if (IS_ERR(qmp_cdev->cdev))
+ if (IS_ERR_OR_NULL(qmp_cdev->cdev)) {
dev_err(qmp->dev, "unable to register %s cooling device\n",
cdev_name);
+ return -ENODEV;
+ }
- return PTR_ERR_OR_ZERO(qmp_cdev->cdev);
+ return 0;
}
static int qmp_cooling_devices_register(struct qmp *qmp)
--
2.47.3
next reply other threads:[~2025-12-12 2:36 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-12 2:36 Haris Wu [this message]
2025-12-12 19:19 ` [PATCH] soc: qcom: aoss: avoid registering cooling for NULL cdev Dmitry Baryshkov
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=20251212023610.13918-1-bymark256@gmail.com \
--to=bymark256@gmail.com \
--cc=andersson@kernel.org \
--cc=konradybcio@kernel.org \
--cc=linux-arm-msm@vger.kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).