aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/hwmon/adm1029.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/hwmon/adm1029.c b/drivers/hwmon/adm1029.c
index ba84ca5923f9..36718150b475 100644
--- a/drivers/hwmon/adm1029.c
+++ b/drivers/hwmon/adm1029.c
@@ -179,7 +179,8 @@ show_fan(struct device *dev, struct device_attribute *devattr, char *buf)
179 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); 179 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
180 struct adm1029_data *data = adm1029_update_device(dev); 180 struct adm1029_data *data = adm1029_update_device(dev);
181 u16 val; 181 u16 val;
182 if (data->fan[attr->index] == 0 || data->fan_div[attr->index] == 0 182 if (data->fan[attr->index] == 0
183 || (data->fan_div[attr->index] & 0xC0) == 0
183 || data->fan[attr->index] == 255) { 184 || data->fan[attr->index] == 255) {
184 return sprintf(buf, "0\n"); 185 return sprintf(buf, "0\n");
185 } 186 }
@@ -194,7 +195,7 @@ show_fan_div(struct device *dev, struct device_attribute *devattr, char *buf)
194{ 195{
195 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); 196 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
196 struct adm1029_data *data = adm1029_update_device(dev); 197 struct adm1029_data *data = adm1029_update_device(dev);
197 if (data->fan_div[attr->index] == 0) 198 if ((data->fan_div[attr->index] & 0xC0) == 0)
198 return sprintf(buf, "0\n"); 199 return sprintf(buf, "0\n");
199 return sprintf(buf, "%d\n", DIV_FROM_REG(data->fan_div[attr->index])); 200 return sprintf(buf, "%d\n", DIV_FROM_REG(data->fan_div[attr->index]));
200} 201}