diff mbox series

[3/3] powercap: arm_scmi: Fix a NULL vs IS_ERR() bug

Message ID 20220817105424.3124006-4-cristian.marussi@arm.com (mailing list archive)
State Superseded
Headers show
Series Add ARM SCMI Powercap driver | expand

Commit Message

Cristian Marussi Aug. 17, 2022, 10:54 a.m. UTC
From: Dan Carpenter <dan.carpenter@oracle.com>

The powercap_register_control_type() return error pointers.  It never
returns NULL.

Fixes: 31afdd34f2b9 ("powercap: arm_scmi: Add SCMI powercap based driver")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 drivers/powercap/arm_scmi_powercap.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/drivers/powercap/arm_scmi_powercap.c b/drivers/powercap/arm_scmi_powercap.c
index dc26cbb32b35..9993b7fa4993 100644
--- a/drivers/powercap/arm_scmi_powercap.c
+++ b/drivers/powercap/arm_scmi_powercap.c
@@ -521,8 +521,8 @@  static int __init scmi_powercap_init(void)
 	int ret;
 
 	scmi_top_pcntrl = powercap_register_control_type(NULL, "arm-scmi", NULL);
-	if (!scmi_top_pcntrl)
-		return -ENODEV;
+	if (IS_ERR(scmi_top_pcntrl))
+		return PTR_ERR(scmi_top_pcntrl);
 
 	ret = scmi_register(&scmi_powercap_driver);
 	if (ret)