diff options
author | Sudeep Holla <sudeep.holla@arm.com> | 2018-03-15 12:54:18 -0400 |
---|---|---|
committer | Sudeep Holla <sudeep.holla@arm.com> | 2018-03-20 08:13:48 -0400 |
commit | c09880cef78d0ddf149cdfeb733027a806465ba2 (patch) | |
tree | 6927b1cf35b6754e99d46654263ee322430110b1 | |
parent | 02f208c5c60549039445402505dea284e15f0f4f (diff) |
hwmon: (scmi) return -EINVAL when sensor information is unavailable
Passing NULL pointer to PTR_ERR will result in return value of 0
indicating success which is clearly not what it is intended here.
This patch returns -EINVAL instead when the sensor information is not
available.
Fixes: b23688aefb8b ("hwmon: add support for sensors exported via ARM SCMI")
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Guenter Roeck <linux@roeck-us.net>
Cc: linux-hwmon@vger.kernel.org
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
-rw-r--r-- | drivers/hwmon/scmi-hwmon.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/hwmon/scmi-hwmon.c b/drivers/hwmon/scmi-hwmon.c index 32e750373ced..363bf56eb0f2 100644 --- a/drivers/hwmon/scmi-hwmon.c +++ b/drivers/hwmon/scmi-hwmon.c | |||
@@ -138,7 +138,7 @@ static int scmi_hwmon_probe(struct scmi_device *sdev) | |||
138 | for (i = 0; i < nr_sensors; i++) { | 138 | for (i = 0; i < nr_sensors; i++) { |
139 | sensor = handle->sensor_ops->info_get(handle, i); | 139 | sensor = handle->sensor_ops->info_get(handle, i); |
140 | if (!sensor) | 140 | if (!sensor) |
141 | return PTR_ERR(sensor); | 141 | return -EINVAL; |
142 | 142 | ||
143 | switch (sensor->type) { | 143 | switch (sensor->type) { |
144 | case TEMPERATURE_C: | 144 | case TEMPERATURE_C: |