hwmon/adm1029 Use mask for fan_div value
Subsystems (2)
PATCH 1/1 hwmon/adm1029 Use mask for fan_div value
Hello
This is my patch for testing correct values of fan div in adm1029 and prevent a division by 0 for some (unlikely) register values.
Signed off by LABBE Corentin <[email protected]>
drivers/hwmon/adm1029.c renamed from drivers/hwmon/adm1029.orig +3 -2
@@ -170,7 +170,8 @@struct sensor_device_attribute *attr =to_sensor_dev_attr (devattr);struct adm1029_data *data =adm1029_update_device (dev);u16 val; -if (data->fan[attr->index] ==0 || data->fan_div[attr->index] ==0 +if (data->fan[attr->index] ==0 + || (data->fan_div[attr->index] &0xC0 ) ==0 || data->fan[attr->index] ==255 ) {return sprintf (buf,"0\n" ); }
@@ -185,7 +186,7 @@ {struct sensor_device_attribute *attr =to_sensor_dev_attr (devattr);struct adm1029_data *data =adm1029_update_device (dev); -if (data->fan_div[attr->index] ==0 ) +if ((data->fan_div[attr->index] &0xC0 ) ==0 )return sprintf (buf,"0\n" );return sprintf (buf,"%d\n" ,DIV_FROM_REG (data->fan_div[attr->index])); }
_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Quoted 7 lines · corentin.labbe
Hello
This is my patch for testing correct values of fan div in adm1029 and prevent a division by 0 for some (unlikely) register values.
Signed off by LABBE Corentin <[email protected]>
Patch applied, thanks!
Signature · 6 lines
Jean Delvare _______________________________________________ lm-sensors mailing list [email protected] http://lists.lm-sensors.org/mailman/listinfo/lm-sensors