Thread (9 messages) 9 messages, 4 authors, 2026-08-30

Re: [PATCH v2 2/2] hwmon: (lm90) Reject channel 2 on chips with only one remote sensor

flat view

From: sashiko-bot@kernel.org
Date: 2026-08-26 18:57:45
Also in: linux-hwmon

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] Incorrect format specifier '%d' used for 'u32' variable.
--

commit dbab4ee8e2d548c97ffd31b1a3d640af352905b1
Author: Flaviu Nistor [off-list ref]

hwmon: (lm90) Reject channel 2 on chips with only one remote sensor

This commit validates firmware channel definitions against chip capabilities
and returns -EINVAL when channel 2 is configured on devices with 1 remote
channel.
quoted hunk ↗ jump to hunk
diff --git a/drivers/hwmon/lm90.c b/drivers/hwmon/lm90.c
index 1c603272538aa..3faeb2c6ab01b 100644
--- a/drivers/hwmon/lm90.c
+++ b/drivers/hwmon/lm90.c
@@ -2712,6 +2712,11 @@ static int lm90_probe_channel(struct i2c_client *client,
 		return -EINVAL;
 	}
 
+	if (id == 2 && !(data->flags & LM90_HAVE_TEMP3)) {
+		dev_err(dev, "channel %d is not supported for this chip in %pfw\n", id, child);
[Severity: Low]
Does this code use the correct format specifier for the id variable?

While passing an unsigned 32-bit integer to a %d specifier works for small
values (since id is guaranteed to be exactly 2 on this path), it is
semantically incorrect for a u32 variable and violates format string
contracts, leading to potential compiler warnings (-Wformat).

Would it be better to use %u as the format specifier for a u32?
quoted hunk ↗ jump to hunk
+		return -EINVAL;
+	}
+
 	err = fwnode_property_read_string(child, "label", &data->channel_label[id]);
-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260826184750.4798-1-flaviu.nistor@gmail.com?part=2
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help