mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v3 0/3] cpufreq: Use int type to store negative error codes
@ 2025-09-02 11:45 Qianfeng Rong
  2025-09-02 11:45 ` [PATCH v3 1/3] " Qianfeng Rong
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Qianfeng Rong @ 2025-09-02 11:45 UTC (permalink / raw)
  To: Rafael J. Wysocki, Viresh Kumar,
	open list:CPU FREQUENCY SCALING FRAMEWORK, open list
  Cc: Qianfeng Rong

The 'ret' variable usually is used to store returns from some functions,
which return either zero on success or negative error codes on failure.

Storing the negative error codes in unsigned type, doesn't cause an issue
at runtime but can be confusing.  Additionally, assigning negative error
codes to unsigned type may trigger a GCC warning when the -Wsign-conversion
flag is enabled.

Change "ret" from unsigned int to int type.  No effect on runtime.

Signed-off-by: Qianfeng Rong <rongqianfeng@vivo.com>
---
Change in v2:
- Modified commit message.

Changes in v3:
- Split each driver into a separate patch.
- In drivers/cpufreq/powernow-k7.c, remove the 'unsigned int ret' variable
  from the powernow_decode_bios() function; since it is only used in one
  place, this simplifies the code.
---
Qianfeng Rong (3):
  cpufreq: Use int type to store negative error codes
  cpufreq: powernow: Use int type to store negative error codes
  cpufreq: speedstep-lib: Use int type to store negative error codes

 drivers/cpufreq/cpufreq.c       |  2 +-
 drivers/cpufreq/powernow-k7.c   |  4 +---
 drivers/cpufreq/speedstep-lib.c | 12 ++++++------
 drivers/cpufreq/speedstep-lib.h | 10 +++++-----
 4 files changed, 13 insertions(+), 15 deletions(-)

-- 
2.34.1


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2025-09-05 18:59 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-09-02 11:45 [PATCH v3 0/3] cpufreq: Use int type to store negative error codes Qianfeng Rong
2025-09-02 11:45 ` [PATCH v3 1/3] " Qianfeng Rong
2025-09-03  4:12   ` Viresh Kumar
2025-09-02 11:45 ` [PATCH v3 2/3] cpufreq: powernow: " Qianfeng Rong
2025-09-03  4:14   ` Viresh Kumar
2025-09-03  6:50     ` Qianfeng Rong
2025-09-02 11:45 ` [PATCH v3 3/3] cpufreq: speedstep-lib: " Qianfeng Rong
2025-09-03  4:13   ` Viresh Kumar
2025-09-05 18:59     ` Rafael J. Wysocki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®