From: Dan Carpenter <dan.carpenter@oracle.com>
To: "Rafael J. Wysocki" <rjw@rjwysocki.net>,
Daniel Lezcano <daniel.lezcano@linaro.org>
Cc: Lukasz Luba <lukasz.luba@arm.com>,
linux-pm@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: [PATCH 3/3] powercap/drivers/dtpm: Fix an IS_ERR() vs NULL check
Date: Wed, 6 Jan 2021 12:03:08 +0300 [thread overview]
Message-ID: <X/V8zHPwlGiSxq1M@mwanda> (raw)
In-Reply-To: <X/V2k8dwaXJH6VFh@mwanda>
The powercap_register_control_type() function never returns NULL, it
returns error pointers on error so update this check.
Fixes: a20d0ef97abf ("powercap/drivers/dtpm: Add API for dynamic thermal power management")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
drivers/powercap/dtpm.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/powercap/dtpm.c b/drivers/powercap/dtpm.c
index 470a1182b868..5a51cd34a7e8 100644
--- a/drivers/powercap/dtpm.c
+++ b/drivers/powercap/dtpm.c
@@ -467,9 +467,9 @@ static int __init dtpm_init(void)
struct dtpm_descr **dtpm_descr;
pct = powercap_register_control_type(NULL, "dtpm", NULL);
- if (!pct) {
+ if (IS_ERR(pct)) {
pr_err("Failed to register control type\n");
- return -EINVAL;
+ return PTR_ERR(pct);
}
for_each_dtpm_table(dtpm_descr)
--
2.29.2
next prev parent reply other threads:[~2021-01-06 9:04 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-06 8:36 [PATCH 1/3] powercap/drivers/dtpm: Fix a double shift bug Dan Carpenter
2021-01-06 8:41 ` [PATCH 2/3] powercap/drivers/dtpm: Fix some missing unlock bugs Dan Carpenter
2021-01-07 17:01 ` Daniel Lezcano
2021-01-06 9:03 ` Dan Carpenter [this message]
2021-01-07 17:03 ` [PATCH 3/3] powercap/drivers/dtpm: Fix an IS_ERR() vs NULL check Daniel Lezcano
2021-01-07 17:19 ` Rafael J. Wysocki
2021-01-07 16:59 ` [PATCH 1/3] powercap/drivers/dtpm: Fix a double shift bug Daniel Lezcano
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=X/V8zHPwlGiSxq1M@mwanda \
--to=dan.carpenter@oracle.com \
--cc=daniel.lezcano@linaro.org \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=lukasz.luba@arm.com \
--cc=rjw@rjwysocki.net \
/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