From: Ethan Tidmore Date: Fri, 3 Apr 2026 07:09:28 +0000 (-0500) Subject: platform/x86: uniwill-laptop: Fix signedness bug X-Git-Tag: v7.1-rc1~71^2~18 X-Git-Url: http://git.ipfire.org/gitweb/index.cgi?a=commitdiff_plain;h=6b0567dc4c9ad140044400e06dd97fdce12c204f;p=thirdparty%2Fkernel%2Flinux.git platform/x86: uniwill-laptop: Fix signedness bug The function sysfs_match_string() can return negative error codes and the variable assigned to it is the enum 'option'. Which could be an unsigned int due to different compiler implementations. Assign signed variable 'ret' to sysfs_match_string(), check for error, then assign ret to option. Detected by Smatch: drivers/platform/x86/uniwill/uniwill-acpi.c:919 usb_c_power_priority_store() warn: unsigned 'option' is never less than zero. Fixes: 03ae0a0d0973b ("platform/x86: uniwill-laptop: Implement USB-C power priority setting") Signed-off-by: Ethan Tidmore Link: https://patch.msgid.link/20260403070928.802196-1-ethantidmore06@gmail.com Reviewed-by: Ilpo Järvinen Signed-off-by: Ilpo Järvinen --- diff --git a/drivers/platform/x86/uniwill/uniwill-acpi.c b/drivers/platform/x86/uniwill/uniwill-acpi.c index faade4cf08bec..945df50926371 100644 --- a/drivers/platform/x86/uniwill/uniwill-acpi.c +++ b/drivers/platform/x86/uniwill/uniwill-acpi.c @@ -915,10 +915,11 @@ static ssize_t usb_c_power_priority_store(struct device *dev, unsigned int value; int ret; - option = sysfs_match_string(usb_c_power_priority_text, buf); - if (option < 0) - return option; + ret = sysfs_match_string(usb_c_power_priority_text, buf); + if (ret < 0) + return ret; + option = ret; value = usb_c_power_priority_value[option]; guard(mutex)(&data->usb_c_power_priority_lock);