From: Bruno Thomsen Date: Tue, 11 Nov 2025 14:44:05 +0000 (+0100) Subject: hwmon: (tmp421) Check error when loading label from dt X-Git-Tag: v6.19-rc1~148^2~25 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=638196d43bd3c8548c6576d26475e071c023a9b3;p=thirdparty%2Fkernel%2Flinux.git hwmon: (tmp421) Check error when loading label from dt Add error checking when loading temperature channel label defined in device tree. Handling of error from of_property_read_string() is inspired by lm90 driver and therefor contain same error string. Signed-off-by: Bruno Thomsen Link: https://lore.kernel.org/r/20251111144406.7489-1-bruno.thomsen@gmail.com Signed-off-by: Guenter Roeck --- diff --git a/drivers/hwmon/tmp421.c b/drivers/hwmon/tmp421.c index 2e43ce8408d6c..5d6babdadf895 100644 --- a/drivers/hwmon/tmp421.c +++ b/drivers/hwmon/tmp421.c @@ -369,7 +369,11 @@ static int tmp421_probe_child_from_dt(struct i2c_client *client, return -EINVAL; } - of_property_read_string(child, "label", &data->channel[i].label); + err = of_property_read_string(child, "label", &data->channel[i].label); + if (err == -ENODATA || err == -EILSEQ) { + dev_err(dev, "invalid label property in %pOFn\n", child); + return err; + } if (data->channel[i].label) data->temp_config[i] |= HWMON_T_LABEL;