hwmon: Handle failure to register sensor with thermal zone correctly
Merge Request Required Information
Summary of Changes
If devm_thermal_zone_of_sensor_register() returns -ENODEV,
report that the sensor was not attached to a thermal zone
but continue to register the hwmon device.
## Approved Bugzilla Ticket
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2122394
Upstream Status: git@gitlab.com:redhat/centos-stream/src/kernel/centos-stream-9.git
Signed-off-by: David Marlin <dmarlin@redhat.com>
## Scratch Brew build
https://brewweb.engineering.redhat.com/brew/taskinfo?taskID=49249631
## Description
If an attempt is made to a sensor with a thermal zone and it fails,
the call to devm_thermal_zone_of_sensor_register() may return -ENODEV.
This can result in a crash (NULL pointer dereference).
The hwmon core needs to handle all errors returned from calls
to devm_thermal_zone_of_sensor_register(). If the call fails
with -ENODEV, report that the sensor was not attached to a
thermal zone but continue to register the hwmon device.
Edited by David Marlin