hwmon: Deal with errors from the thermal subsystem
authorLinus Walleij <linus.walleij@linaro.org>
Tue, 5 Dec 2017 08:36:14 +0000 (09:36 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 29 Jan 2020 14:02:37 +0000 (15:02 +0100)
commit4c7b99b4c03b546c4ea2e7562ee083e5f3a2c0e6
tree77dbda8b054a83ce7ced114ecbb87d64cb771edd
parent6090ac18fcc58ed264ffdd00f6fdd6042475b6a4
hwmon: Deal with errors from the thermal subsystem

commit 47c332deb8e89f6c59b0bb2615945c6e7fad1a60 upstream.

If the thermal subsystem returne -EPROBE_DEFER or any other error
when hwmon calls devm_thermal_zone_of_sensor_register(), this is
silently ignored.

I ran into this with an incorrectly defined thermal zone, making
it non-existing and thus this call failed with -EPROBE_DEFER
assuming it would appear later. The sensor was still added
which is incorrect: sensors must strictly be added after the
thermal zones, so deferred probe must be respected.

Fixes: d560168b5d0f ("hwmon: (core) New hwmon registration API")
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/hwmon/hwmon.c