Configuring the pwm polarity via the adi,pwm-active-state property is an optional feature. On DT aware platforms of_property_read_u32_array() returns -EINVAL when the property is absent this is checked for and the driver probe continues without issue. On DT unaware platfroms of_property_read_u32_array() returns -ENOSYS which caused the driver probe to dev_warn(). Update the code to deal with -ENOSYS so that the dev_warn() only occurs when there is a genuine issue. Fixes: 86da28eed4fb ("hwmon: (adt7475) Add support for inverting pwm output") Reported-by: Mariusz Białończyk <manio@xxxxxxxxxx> Signed-off-by: Chris Packham <chris.packham@xxxxxxxxxxxxxxxxxxx> --- drivers/hwmon/adt7475.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/hwmon/adt7475.c b/drivers/hwmon/adt7475.c index 6e4c92b500b8..af906eee480e 100644 --- a/drivers/hwmon/adt7475.c +++ b/drivers/hwmon/adt7475.c @@ -1607,6 +1607,13 @@ static int adt7475_set_pwm_polarity(struct i2c_client *client) ret = of_property_read_u32_array(client->dev.of_node, "adi,pwm-active-state", states, ARRAY_SIZE(states)); + /* + * -EINVAL indicates that the property is absent, -ENOSYS indicates + * that the platform lacks DT awareness. Neither of these are errors + * for the optional pwm polarity support. + */ + if (ret == -EINVAL || ret == -ENOSYS) + return 0; if (ret) return ret; @@ -1741,7 +1748,7 @@ static int adt7475_probe(struct i2c_client *client) adt7475_read_pwm(client, i); ret = adt7475_set_pwm_polarity(client); - if (ret && ret != -EINVAL) + if (ret) dev_warn(&client->dev, "Error configuring pwm polarity\n"); /* Start monitoring */ -- 2.40.0