drivers: thermal: tsens: Add new operation to check if a sensor is enabled
Hello Amit Kucheria,
The patch 686539daac9f: "drivers: thermal: tsens: Add new operation to check if a sensor is enabled" from Mar 20, 2019, leads to the following static checker warning:
drivers/thermal/qcom/tsens-common.c:73 is_sensor_enabled()
warn: signedness bug returning '(-22)'
drivers/thermal/qcom/tsens-common.c
67 bool is_sensor_enabled(struct tsens_priv *priv, u32 hw_id)
^^^^
68 {
69 u32 val;
70 int ret;
71
72 if ((hw_id > (priv->num_sensors - 1)) || (hw_id < 0))
73 return -EINVAL;
^^^^^^^^^^^^^^
74 ret = regmap_field_read(priv->rf[SENSOR_EN], &val);
75 if (ret)
76 return ret;
^^^^^^^^^^
77
78 return val & (1 << hw_id);
79 }regards,
dan carpenter