Skip to contentSkip to conversation

platform: sps: Fix an unsigned comparison that can

PATCH Superseded [email protected] 1 participant 1 message Aug 13, 2023

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 platform: sps: Fix an unsigned comparison that can

From: Rajeshwar R Shinde <[email protected]>

The variable 'mode' is declared as unsigned int in local function. The return value of function amd_pmf_get_pprof_modes(dev) is int and it is stored in the 'mode' variable. Also the value of 'mode' variable is compared with 0 which is signed int by default. Thus redeclaring the variable to signed int.

This fixes warning such as:
drivers/platform/x86/amd/pmf/sps.c:128:5-9:
WARNING: Unsigned expression compared with zero: mode < 0

---
 drivers/platform/x86/amd/pmf/sps.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/platform/x86/amd/pmf/sps.c +1 -1
index ab69d517a36a..703723a66830 100644
@@ -176,7 +176,7 @@ int amd_pmf_get_pprof_modes(struct amd_pmf_dev *pmf)
 
 int amd_pmf_power_slider_update_event(struct amd_pmf_dev *dev)
 {
-	u8 mode, flag = 0;
+	int mode, flag = 0;
 	int src;
 
 	mode = amd_pmf_get_pprof_modes(dev);
Signature · 1 line
2.25.1