2022-07-05 02:53:21

by Yang Li

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

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 <[email protected]>
---
drivers/powercap/arm_scmi_powercap.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

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;
};
--
2.20.1.7.g153144c