]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
hwmon: tmp401: Read "ti,n-factor" as signed
authorRob Herring (Arm) <robh@kernel.org>
Fri, 12 Jun 2026 21:53:32 +0000 (16:53 -0500)
committerGuenter Roeck <linux@roeck-us.net>
Sat, 13 Jun 2026 12:53:18 +0000 (05:53 -0700)
The "ti,n-factor" binding and examples allow negative correction
values. Reading it as u32 makes the helper type disagree with the
documented signed value and hides real schema mismatches.

Use the signed helper so the DT access matches the s32 value stored by
the driver.

Assisted-by: Codex:gpt-5-5
Signed-off-by: Rob Herring (Arm) <robh@kernel.org>
Link: https://lore.kernel.org/r/20260612215332.1889497-1-robh@kernel.org
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
drivers/hwmon/tmp401.c

index a09225a87355dd907f778f5d94ef48896352efab..ca0ff525ea29fd45f76a3131c6753896ac4d124b 100644 (file)
@@ -560,7 +560,7 @@ static int tmp401_init_client(struct tmp401_data *data)
                        return ret;
        }
 
-       ret = of_property_read_u32(data->client->dev.of_node, "ti,n-factor", &nfactor);
+       ret = of_property_read_s32(data->client->dev.of_node, "ti,n-factor", &nfactor);
        if (!ret) {
                if (data->kind == tmp401) {
                        dev_err(&data->client->dev, "ti,tmp401 does not support n-factor correction\n");