summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorKaushlendra Kumar <kaushlendra.kumar@intel.com>2025-08-28 12:00:00 +0530
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2025-11-13 15:34:06 -0500
commiteff9be1646922a3a0d2c0dc569d82f2f041db312 (patch)
tree709f87d12073d0062525fdcdbf06b6b4da58d282 /tools
parentffd87e786745b366458957afa87441808d916b17 (diff)
downloadlinux-eff9be1646922a3a0d2c0dc569d82f2f041db312.tar.gz
linux-eff9be1646922a3a0d2c0dc569d82f2f041db312.tar.bz2
linux-eff9be1646922a3a0d2c0dc569d82f2f041db312.zip
tools/cpupower: fix error return value in cpupower_write_sysfs()
[ Upstream commit 57b100d4cf14276e0340eecb561005c07c129eb8 ] The cpupower_write_sysfs() function currently returns -1 on write failure, but the function signature indicates it should return an unsigned int. Returning -1 from an unsigned function results in a large positive value rather than indicating an error condition. Fix this by returning 0 on failure, which is more appropriate for an unsigned return type and maintains consistency with typical success/failure semantics where 0 indicates failure and non-zero indicates success (bytes written). Link: https://lore.kernel.org/r/20250828063000.803229-1-kaushlendra.kumar@intel.com Signed-off-by: Kaushlendra Kumar <kaushlendra.kumar@intel.com> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'tools')
-rw-r--r--tools/power/cpupower/lib/cpupower.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/power/cpupower/lib/cpupower.c b/tools/power/cpupower/lib/cpupower.c
index 7a2ef691b20e..c2a7af89a67b 100644
--- a/tools/power/cpupower/lib/cpupower.c
+++ b/tools/power/cpupower/lib/cpupower.c
@@ -55,7 +55,7 @@ unsigned int cpupower_write_sysfs(const char *path, char *buf, size_t buflen)
if (numwritten < 1) {
perror(path);
close(fd);
- return -1;
+ return 0;
}
close(fd);