* [PATCH 1/2] hwmon: tmp421: check error when loading label from dt
@ 2025-11-11 14:44 Bruno Thomsen
2025-11-11 14:44 ` [PATCH 2/2] hwmon: tmp421: remove duplicate return in switch-case Bruno Thomsen
2025-11-12 20:15 ` [PATCH 1/2] hwmon: tmp421: check error when loading label from dt Guenter Roeck
0 siblings, 2 replies; 4+ messages in thread
From: Bruno Thomsen @ 2025-11-11 14:44 UTC (permalink / raw)
To: linux-hwmon; +Cc: Guenter Roeck, Bruno Thomsen, linux-kernel
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 <bruno.thomsen@gmail.com>
---
drivers/hwmon/tmp421.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/hwmon/tmp421.c b/drivers/hwmon/tmp421.c
index 9537727aad9a..1eded169e843 100644
--- a/drivers/hwmon/tmp421.c
+++ b/drivers/hwmon/tmp421.c
@@ -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
--
2.51.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/2] hwmon: tmp421: remove duplicate return in switch-case
2025-11-11 14:44 [PATCH 1/2] hwmon: tmp421: check error when loading label from dt Bruno Thomsen
@ 2025-11-11 14:44 ` Bruno Thomsen
2025-11-12 20:15 ` Guenter Roeck
2025-11-12 20:15 ` [PATCH 1/2] hwmon: tmp421: check error when loading label from dt Guenter Roeck
1 sibling, 1 reply; 4+ messages in thread
From: Bruno Thomsen @ 2025-11-11 14:44 UTC (permalink / raw)
To: linux-hwmon; +Cc: Guenter Roeck, Bruno Thomsen, linux-kernel
Use single read permission return in switch-case that handles
attributes in tmp421_is_visible().
Signed-off-by: Bruno Thomsen <bruno.thomsen@gmail.com>
---
drivers/hwmon/tmp421.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/drivers/hwmon/tmp421.c b/drivers/hwmon/tmp421.c
index 1eded169e843..23ed3fbc9c99 100644
--- a/drivers/hwmon/tmp421.c
+++ b/drivers/hwmon/tmp421.c
@@ -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:
--
2.51.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 1/2] hwmon: tmp421: check error when loading label from dt
2025-11-11 14:44 [PATCH 1/2] hwmon: tmp421: check error when loading label from dt Bruno Thomsen
2025-11-11 14:44 ` [PATCH 2/2] hwmon: tmp421: remove duplicate return in switch-case Bruno Thomsen
@ 2025-11-12 20:15 ` Guenter Roeck
1 sibling, 0 replies; 4+ messages in thread
From: Guenter Roeck @ 2025-11-12 20:15 UTC (permalink / raw)
To: Bruno Thomsen; +Cc: linux-hwmon, linux-kernel
On Tue, Nov 11, 2025 at 03:44:05PM +0100, Bruno Thomsen wrote:
> 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 <bruno.thomsen@gmail.com>
Applied.
Thanks,
Guenter
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 2/2] hwmon: tmp421: remove duplicate return in switch-case
2025-11-11 14:44 ` [PATCH 2/2] hwmon: tmp421: remove duplicate return in switch-case Bruno Thomsen
@ 2025-11-12 20:15 ` Guenter Roeck
0 siblings, 0 replies; 4+ messages in thread
From: Guenter Roeck @ 2025-11-12 20:15 UTC (permalink / raw)
To: Bruno Thomsen; +Cc: linux-hwmon, linux-kernel
On Tue, Nov 11, 2025 at 03:44:06PM +0100, Bruno Thomsen wrote:
> Use single read permission return in switch-case that handles
> attributes in tmp421_is_visible().
>
> Signed-off-by: Bruno Thomsen <bruno.thomsen@gmail.com>
Applied.
Thanks,
Guenter
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-11-12 20:15 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-11 14:44 [PATCH 1/2] hwmon: tmp421: check error when loading label from dt Bruno Thomsen
2025-11-11 14:44 ` [PATCH 2/2] hwmon: tmp421: remove duplicate return in switch-case Bruno Thomsen
2025-11-12 20:15 ` Guenter Roeck
2025-11-12 20:15 ` [PATCH 1/2] hwmon: tmp421: check error when loading label from dt Guenter Roeck
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox