]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
hwmon: (pmbus/isl68137) Fix unchecked return value and use sysfs_emit()
authorSanman Pradhan <psanman@juniper.net>
Wed, 18 Mar 2026 19:40:19 +0000 (19:40 +0000)
committerGuenter Roeck <linux@roeck-us.net>
Wed, 18 Mar 2026 20:38:55 +0000 (13:38 -0700)
commit86259558e422b250aa6aa57163a6d759074573f5
treeffa9162b2260e7f50f623b553272452318c7af70
parent32f59301b9898c0ab5e72908556d553e2d481945
hwmon: (pmbus/isl68137) Fix unchecked return value and use sysfs_emit()

isl68137_avs_enable_show_page() uses the return value of
pmbus_read_byte_data() without checking for errors. If the I2C transaction
fails, a negative error code is passed through bitwise operations,
producing incorrect output.

Add an error check to propagate the return value if it is negative.
Additionally, modernize the callback by replacing sprintf()
with sysfs_emit().

Fixes: 038a9c3d1e424 ("hwmon: (pmbus/isl68137) Add driver for Intersil ISL68137 PWM Controller")
Cc: stable@vger.kernel.org
Signed-off-by: Sanman Pradhan <psanman@juniper.net>
Link: https://lore.kernel.org/r/20260318193952.47908-2-sanman.pradhan@hpe.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
drivers/hwmon/pmbus/isl68137.c