Messages in this thread |  | | From | Qianfeng Rong <> | | Subject | [PATCH v3 0/3] cpufreq: Use int type to store negative error codes | | Date | Tue, 2 Sep 2025 19:45:41 +0800 |
| |
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
|  |