summaryrefslogtreecommitdiffstats
path: root/drivers/powercap/dtpm.c
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2021-01-06 10:03:08 +0100
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2021-01-07 18:13:51 +0100
commitf8f706ad75abbc65fee365853e7b24731223fd6d (patch)
tree48a228bf4c80bede9475334849afd983c55326ae /drivers/powercap/dtpm.c
parentpowercap/drivers/dtpm: Fix some missing unlock bugs (diff)
downloadlinux-f8f706ad75abbc65fee365853e7b24731223fd6d.tar.xz
linux-f8f706ad75abbc65fee365853e7b24731223fd6d.zip
powercap/drivers/dtpm: Fix an IS_ERR() vs NULL check
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> Acked-by: Daniel Lezcano <daniel.lezcano@linaro.org> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/powercap/dtpm.c')
-rw-r--r--drivers/powercap/dtpm.c4
1 files 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)