Skip to content

Commit

Permalink
Merge tag 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/ker…
Browse files Browse the repository at this point in the history
…nel/git/groeck/linux-staging

Pull hwmon fixes from Guenter Roeck:
 "Two minor fixes in emc2103 and applesmc drivers."

* tag 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging:
  hwmon: (emc2103) Fix use of an uninitilized variable in error case
  hwmon: (applesmc) Limit key length in warning messages
  • Loading branch information
Linus Torvalds committed Jun 21, 2012
2 parents 7940b2a + 2355375 commit 7b83778
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
4 changes: 2 additions & 2 deletions drivers/hwmon/applesmc.c
Original file line number Diff line number Diff line change
Expand Up @@ -215,15 +215,15 @@ static int read_smc(u8 cmd, const char *key, u8 *buffer, u8 len)
int i;

if (send_command(cmd) || send_argument(key)) {
pr_warn("%s: read arg fail\n", key);
pr_warn("%.4s: read arg fail\n", key);
return -EIO;
}

outb(len, APPLESMC_DATA_PORT);

for (i = 0; i < len; i++) {
if (__wait_status(0x05)) {
pr_warn("%s: read data fail\n", key);
pr_warn("%.4s: read data fail\n", key);
return -EIO;
}
buffer[i] = inb(APPLESMC_DATA_PORT);
Expand Down
12 changes: 8 additions & 4 deletions drivers/hwmon/emc2103.c
Original file line number Diff line number Diff line change
Expand Up @@ -451,19 +451,23 @@ 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;
else
conf_reg &= ~0x80;

i2c_smbus_write_byte_data(client, REG_FAN_CONF1, conf_reg);

err:
mutex_unlock(&data->update_lock);
return count;
}
Expand Down

0 comments on commit 7b83778

Please sign in to comment.