提交 c09880ce 编写于 作者: S Sudeep Holla

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: b23688ae ("hwmon: add support for sensors exported via ARM SCMI")
Reported-by: NDan Carpenter <dan.carpenter@oracle.com>
Acked-by: NGuenter Roeck <linux@roeck-us.net>
Cc: linux-hwmon@vger.kernel.org
Signed-off-by: NSudeep Holla <sudeep.holla@arm.com>
上级 02f208c5
......@@ -138,7 +138,7 @@ static int scmi_hwmon_probe(struct scmi_device *sdev)
for (i = 0; i < nr_sensors; i++) {
sensor = handle->sensor_ops->info_get(handle, i);
if (!sensor)
return PTR_ERR(sensor);
return -EINVAL;
switch (sensor->type) {
case TEMPERATURE_C:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册