* [PATCH v2] platform: sps: Fix an unsigned comparison that can never be negative
@ 2023-08-13 11:08 coolrrsh
2023-08-13 12:46 ` Hans de Goede
0 siblings, 1 reply; 2+ messages in thread
From: coolrrsh @ 2023-08-13 11:08 UTC (permalink / raw)
To: Shyam-sundar.S-k, hdegoede, markgross, platform-driver-x86,
linux-kernel
Cc: linux-kernel-mentees, Rajeshwar R Shinde
From: Rajeshwar R Shinde <coolrrsh@gmail.com>
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
Signed-off-by: Rajeshwar R Shinde <coolrrsh@gmail.com>
---
v1->v2
changed the commit subject
---
drivers/platform/x86/amd/pmf/sps.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/platform/x86/amd/pmf/sps.c b/drivers/platform/x86/amd/pmf/sps.c
index ab69d517a36a..703723a66830 100644
--- a/drivers/platform/x86/amd/pmf/sps.c
+++ b/drivers/platform/x86/amd/pmf/sps.c
@@ -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);
--
2.25.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v2] platform: sps: Fix an unsigned comparison that can never be negative
2023-08-13 11:08 [PATCH v2] platform: sps: Fix an unsigned comparison that can never be negative coolrrsh
@ 2023-08-13 12:46 ` Hans de Goede
0 siblings, 0 replies; 2+ messages in thread
From: Hans de Goede @ 2023-08-13 12:46 UTC (permalink / raw)
To: coolrrsh, Shyam-sundar.S-k, markgross, platform-driver-x86,
linux-kernel
Cc: linux-kernel-mentees
Hi,
On 8/13/23 13:08, coolrrsh@gmail.com wrote:
> From: Rajeshwar R Shinde <coolrrsh@gmail.com>
>
> 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
>
> Signed-off-by: Rajeshwar R Shinde <coolrrsh@gmail.com>
Thank you your patch.
This has already been fixed by a patch which is pending in the pdx86/fixes branch:
https://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86.git/commit/?h=fixes&id=785c00993dc4c4bb2f7b0f3a3f29c03a6f7aab2e
https://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86.git/log/?h=fixes
Regards,
Hans
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-08-13 12:47 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-13 11:08 [PATCH v2] platform: sps: Fix an unsigned comparison that can never be negative coolrrsh
2023-08-13 12:46 ` Hans de Goede
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox