diff mbox series

[v5,8/9] hwmon: (tmp421) ignore non-channel related DT nodes

Message ID 8e9e332b18dc2cf545f8e8255157e408d356f916.1634206677.git.krzysztof.adamski@nokia.com (mailing list archive)
State Accepted
Headers show
Series Add per channel properies support in tmp421 | expand

Commit Message

Krzysztof Adamski Oct. 14, 2021, 1:11 p.m. UTC
In case the DT contains some nodes not describing the input channels,
ignore them instead of exiting with error.

Signed-off-by: Krzysztof Adamski <krzysztof.adamski@nokia.com>
---
  drivers/hwmon/tmp421.c | 3 +++
  1 file changed, 3 insertions(+)

Comments

Guenter Roeck Oct. 15, 2021, 10:56 p.m. UTC | #1
On Thu, Oct 14, 2021 at 03:11:02PM +0200, Krzysztof Adamski wrote:
> In case the DT contains some nodes not describing the input channels,
> ignore them instead of exiting with error.
> 
> Signed-off-by: Krzysztof Adamski <krzysztof.adamski@nokia.com>

Applied, after the usual fixup.

Guenter

> ---
>  drivers/hwmon/tmp421.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/hwmon/tmp421.c b/drivers/hwmon/tmp421.c
> index 2e20c558fcb0..493a24cdfca2 100644
> --- a/drivers/hwmon/tmp421.c
> +++ b/drivers/hwmon/tmp421.c
> @@ -414,6 +414,9 @@ static int tmp421_probe_from_dt(struct i2c_client *client, struct tmp421_data *d
>  	int err;
>  
>  	for_each_child_of_node(np, child) {
> +		if (strcmp(child->name, "channel"))
> +			continue;
> +
>  		err = tmp421_probe_child_from_dt(client, child, data);
>  		if (err)
>  			return err;
diff mbox series

Patch

diff --git a/drivers/hwmon/tmp421.c b/drivers/hwmon/tmp421.c
index 2e20c558fcb0..493a24cdfca2 100644
--- a/drivers/hwmon/tmp421.c
+++ b/drivers/hwmon/tmp421.c
@@ -414,6 +414,9 @@  static int tmp421_probe_from_dt(struct i2c_client *client, struct tmp421_data *d
  	int err;
  
  	for_each_child_of_node(np, child) {
+		if (strcmp(child->name, "channel"))
+			continue;
+
  		err = tmp421_probe_child_from_dt(client, child, data);
  		if (err)
  			return err;