hwmon: tmp421: check error when loading label from dt
PATCH 1/2 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.
--- drivers/hwmon/tmp421.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/hwmon/tmp421.c +5 -1
@@ -381,7 +381,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 ;
base-commit: 284922f4c563aa3a8558a00f2a05722133237fe8
Signature · 1 line
2.51.1
PATCH 2/2 hwmon: tmp421: remove duplicate return in switch-case
Use single read permission return in switch-case that handles attributes in tmp421_is_visible().
--- drivers/hwmon/tmp421.c | 1 - 1 file changed, 1 deletion(-)
drivers/hwmon/tmp421.c +0 -1
@@ -262,7 +262,6 @@ static umode_t tmp421_is_visible(const void *data, enum hwmon_sensor_types type,switch (attr) {case hwmon_temp_fault:case hwmon_temp_input: -return 0444 ;case hwmon_temp_label:return 0444 ;case hwmon_temp_enable:
Signature · 1 line
2.51.1
Re: [PATCH 2/2] hwmon: tmp421: remove duplicate return in switch-case
Quoted 4 lines · Bruno Thomsen
Use single read permission return in switch-case that handles attributes in
tmp421_is_visible().Signed-off-by Bruno Thomsen <[email protected]>
Applied.
Thanks,
Guenter
Quoted 5 lines · Bruno Thomsen
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 <[email protected]>
Applied.
Thanks,
Guenter