hwmon: (scmi) return -EINVAL when sensor information is unavailable
authorSudeep Holla <sudeep.holla@arm.com>
Thu, 15 Mar 2018 16:54:18 +0000 (16:54 +0000)
committerSudeep Holla <sudeep.holla@arm.com>
Tue, 20 Mar 2018 12:13:48 +0000 (12:13 +0000)
commitc09880cef78d0ddf149cdfeb733027a806465ba2
tree6927b1cf35b6754e99d46654263ee322430110b1
parent02f208c5c60549039445402505dea284e15f0f4f
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>
drivers/hwmon/scmi-hwmon.c