diff options
Diffstat (limited to 'drivers')
| -rw-r--r-- | drivers/hwmon/f71805f.c | 10 | ||||
| -rw-r--r-- | drivers/hwmon/sht15.c | 3 | ||||
| -rw-r--r-- | drivers/hwmon/w83627ehf.c | 6 | 
3 files changed, 13 insertions, 6 deletions
diff --git a/drivers/hwmon/f71805f.c b/drivers/hwmon/f71805f.c index 92f949767ece..6dbfd3e516e4 100644 --- a/drivers/hwmon/f71805f.c +++ b/drivers/hwmon/f71805f.c @@ -283,11 +283,11 @@ static inline long temp_from_reg(u8 reg)  static inline u8 temp_to_reg(long val)  { -	if (val < 0) -		val = 0; -	else if (val > 1000 * 0xff) -		val = 0xff; -	return ((val + 500) / 1000); +	if (val <= 0) +		return 0; +	if (val >= 1000 * 0xff) +		return 0xff; +	return (val + 500) / 1000;  }  /* diff --git a/drivers/hwmon/sht15.c b/drivers/hwmon/sht15.c index 6ddeae049058..91fdd1fe18b0 100644 --- a/drivers/hwmon/sht15.c +++ b/drivers/hwmon/sht15.c @@ -883,7 +883,7 @@ static int sht15_invalidate_voltage(struct notifier_block *nb,  static int __devinit sht15_probe(struct platform_device *pdev)  { -	int ret = 0; +	int ret;  	struct sht15_data *data = kzalloc(sizeof(*data), GFP_KERNEL);  	u8 status = 0; @@ -901,6 +901,7 @@ static int __devinit sht15_probe(struct platform_device *pdev)  	init_waitqueue_head(&data->wait_queue);  	if (pdev->dev.platform_data == NULL) { +		ret = -EINVAL;  		dev_err(&pdev->dev, "no platform data supplied\n");  		goto err_free_data;  	} diff --git a/drivers/hwmon/w83627ehf.c b/drivers/hwmon/w83627ehf.c index 0e0af0445222..2dfae7d7cc5b 100644 --- a/drivers/hwmon/w83627ehf.c +++ b/drivers/hwmon/w83627ehf.c @@ -1319,6 +1319,7 @@ store_pwm_mode(struct device *dev, struct device_attribute *attr,  {  	struct w83627ehf_data *data = dev_get_drvdata(dev);  	struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); +	struct w83627ehf_sio_data *sio_data = dev->platform_data;  	int nr = sensor_attr->index;  	unsigned long val;  	int err; @@ -1330,6 +1331,11 @@ store_pwm_mode(struct device *dev, struct device_attribute *attr,  	if (val > 1)  		return -EINVAL; + +	/* On NCT67766F, DC mode is only supported for pwm1 */ +	if (sio_data->kind == nct6776 && nr && val != 1) +		return -EINVAL; +  	mutex_lock(&data->update_lock);  	reg = w83627ehf_read_value(data, W83627EHF_REG_PWM_ENABLE[nr]);  	data->pwm_mode[nr] = val;  | 
