diff mbox series

[-next] powercap: arm_scmi: Fix an ignored error return from num_domains_get()

Message ID 20220705022557.19747-1-yang.lee@linux.alibaba.com
State New
Headers show
Series [-next] powercap: arm_scmi: Fix an ignored error return from num_domains_get() | expand

Commit Message

Yang Li July 5, 2022, 2:25 a.m. UTC
On line 428 pr->num_zones = powercap_ops->num_domains_get(), the return
of num_domains_get() is int, it can be a negative error code, however
this is being assigned to an unsigned int variable, so make the num_zones
to int to solve this problem without affecting other functions.

Eliminate the following coccicheck warning:
./drivers/powercap/arm_scmi_powercap.c:429:5-18: WARNING: Unsigned expression compared with zero: pr -> num_zones < 0

Signed-off-by: Yang Li <yang.lee@linux.alibaba.com>
---
 drivers/powercap/arm_scmi_powercap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/drivers/powercap/arm_scmi_powercap.c b/drivers/powercap/arm_scmi_powercap.c
index 36f6dc211fbb..11018e63bb8b 100644
--- a/drivers/powercap/arm_scmi_powercap.c
+++ b/drivers/powercap/arm_scmi_powercap.c
@@ -29,7 +29,7 @@  struct scmi_powercap_zone {
 };
 
 struct scmi_powercap_root {
-	unsigned int num_zones;
+	int num_zones;
 	struct scmi_powercap_zone *spzones;
 	struct list_head *registered_zones;
 };