Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c09880ce authored by Sudeep Holla's avatar Sudeep Holla
Browse files

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: default avatarDan Carpenter <dan.carpenter@oracle.com>
Acked-by: default avatarGuenter Roeck <linux@roeck-us.net>
Cc: linux-hwmon@vger.kernel.org
Signed-off-by: default avatarSudeep Holla <sudeep.holla@arm.com>
parent 02f208c5
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -138,7 +138,7 @@ static int scmi_hwmon_probe(struct scmi_device *sdev)
	for (i = 0; i < nr_sensors; i++) {
	for (i = 0; i < nr_sensors; i++) {
		sensor = handle->sensor_ops->info_get(handle, i);
		sensor = handle->sensor_ops->info_get(handle, i);
		if (!sensor)
		if (!sensor)
			return PTR_ERR(sensor);
			return -EINVAL;


		switch (sensor->type) {
		switch (sensor->type) {
		case TEMPERATURE_C:
		case TEMPERATURE_C: