]> Pileus Git - ~andy/linux/blobdiff - drivers/hwmon/emc2103.c
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial
[~andy/linux] / drivers / hwmon / emc2103.c
index a73e68519cbfc92e7a4deecda1cf1fce36df20e4..7bb8e888692c4d7f49d352ab89609d16e7f61ff6 100644 (file)
@@ -451,11 +451,15 @@ static ssize_t set_pwm_enable(struct device *dev, struct device_attribute *da,
                data->fan_rpm_control = true;
                break;
        default:
-               mutex_unlock(&data->update_lock);
-               return -EINVAL;
+               count = -EINVAL;
+               goto err;
        }
 
-       read_u8_from_i2c(client, REG_FAN_CONF1, &conf_reg);
+       result = read_u8_from_i2c(client, REG_FAN_CONF1, &conf_reg);
+       if (result) {
+               count = result;
+               goto err;
+       }
 
        if (data->fan_rpm_control)
                conf_reg |= 0x80;
@@ -463,7 +467,7 @@ static ssize_t set_pwm_enable(struct device *dev, struct device_attribute *da,
                conf_reg &= ~0x80;
 
        i2c_smbus_write_byte_data(client, REG_FAN_CONF1, conf_reg);
-
+err:
        mutex_unlock(&data->update_lock);
        return count;
 }