mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-11 12:28:41 +08:00
hwmon fixes for v6.0-rc4
- Fix out of bounds access in gpio-fan driver - Fix VOUT margin caching in PMBus core - Avoid error message after -EPROBE_DEFER from devm_regulator_register() -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEiHPvMQj9QTOCiqgVyx8mb86fmYEFAmMStVIACgkQyx8mb86f mYED7Q//VUhmjoc6PQ5kbDFEdqsmg0GD5g2LCrQJkzaMxOJUazFWzpzXyQQg5xae tgCKp3CPQAs8YaLKrsAi6+gC3K8xVafEHsg3L603pN+c4ClrzL4tu3ZbhkXPylt8 zS8/s6xJBLQ0+j5sbDK5rt7BXz9R32V10eA/fTxLedaOAVOApEp373wzRbNzt21c hpaEVsqKn2PCbgn32jo/yhkosq0PDgd7mBE6eBDdA4kqhTe43VAyrz8P7tDzytCy 3ZfVvVT4bU8dHa3VF0bKfV/sdm7ZS/oFecH5d2EZNhaF0YYzE4eiuAqqAJeKQjWn b8N/kXgzHtyAgjOspEVUMDh6VBc4x94DyWZsHxIG66iwxVFtA5+oJHR/c+WNHk0P spw0rSYsYobQ8mFqlYOhtdMcX3PFupxGIdnYOZyQ3rim3TdvHtXXdG4ZEWa0txM9 vQDDRtX2+ds9DGhsuIQ7QNoRNL/cDKUFi1zDx+cD5aToY7Tmsud0CvvQao6JLWzi GWBg2p6bM0/Kl8b6ei9BO5Qrm6NA7UqOt7MNNS+cEyvLYBmvHQMBIrBh9kmh6TUP 0iBCDYi+Te3l7QJv1kMLXzZWhyCC5aAhZuauCCYZBRIfEUuzCChfkAuviCjWfnCk YycSkZ6YAj3oVY+ok1bXr3ym04Xdq3FXZlIm2zWs/Y1n6l6CV5M= =7Bi9 -----END PGP SIGNATURE----- Merge tag 'hwmon-for-v6.0-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging Pull hwmon fixes from Guenter Roeck: - Fix out of bounds access in gpio-fan driver - Fix VOUT margin caching in PMBus core - Avoid error message after -EPROBE_DEFER from devm_regulator_register() * tag 'hwmon-for-v6.0-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging: hwmon: (gpio-fan) Fix array out of bounds access hwmon: (pmbus) Fix vout margin caching hwmon: (pmbus) Use dev_err_probe() to filter -EPROBE_DEFER error messages
This commit is contained in:
commit
777464261d
@ -391,6 +391,9 @@ static int gpio_fan_set_cur_state(struct thermal_cooling_device *cdev,
|
||||
if (!fan_data)
|
||||
return -EINVAL;
|
||||
|
||||
if (state >= fan_data->num_speed)
|
||||
return -EINVAL;
|
||||
|
||||
set_fan_speed(fan_data, state);
|
||||
return 0;
|
||||
}
|
||||
|
@ -2861,7 +2861,7 @@ static int pmbus_regulator_get_low_margin(struct i2c_client *client, int page)
|
||||
.data = -1,
|
||||
};
|
||||
|
||||
if (!data->vout_low[page]) {
|
||||
if (data->vout_low[page] < 0) {
|
||||
if (pmbus_check_word_register(client, page, PMBUS_MFR_VOUT_MIN))
|
||||
s.data = _pmbus_read_word_data(client, page, 0xff,
|
||||
PMBUS_MFR_VOUT_MIN);
|
||||
@ -2887,7 +2887,7 @@ static int pmbus_regulator_get_high_margin(struct i2c_client *client, int page)
|
||||
.data = -1,
|
||||
};
|
||||
|
||||
if (!data->vout_high[page]) {
|
||||
if (data->vout_high[page] < 0) {
|
||||
if (pmbus_check_word_register(client, page, PMBUS_MFR_VOUT_MAX))
|
||||
s.data = _pmbus_read_word_data(client, page, 0xff,
|
||||
PMBUS_MFR_VOUT_MAX);
|
||||
@ -3016,11 +3016,10 @@ static int pmbus_regulator_register(struct pmbus_data *data)
|
||||
|
||||
rdev = devm_regulator_register(dev, &info->reg_desc[i],
|
||||
&config);
|
||||
if (IS_ERR(rdev)) {
|
||||
dev_err(dev, "Failed to register %s regulator\n",
|
||||
info->reg_desc[i].name);
|
||||
return PTR_ERR(rdev);
|
||||
}
|
||||
if (IS_ERR(rdev))
|
||||
return dev_err_probe(dev, PTR_ERR(rdev),
|
||||
"Failed to register %s regulator\n",
|
||||
info->reg_desc[i].name);
|
||||
}
|
||||
|
||||
return 0;
|
||||
@ -3320,6 +3319,7 @@ int pmbus_do_probe(struct i2c_client *client, struct pmbus_driver_info *info)
|
||||
struct pmbus_data *data;
|
||||
size_t groups_num = 0;
|
||||
int ret;
|
||||
int i;
|
||||
char *name;
|
||||
|
||||
if (!info)
|
||||
@ -3353,6 +3353,11 @@ int pmbus_do_probe(struct i2c_client *client, struct pmbus_driver_info *info)
|
||||
data->currpage = -1;
|
||||
data->currphase = -1;
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(data->vout_low); i++) {
|
||||
data->vout_low[i] = -1;
|
||||
data->vout_high[i] = -1;
|
||||
}
|
||||
|
||||
ret = pmbus_init_common(client, data, info);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
Loading…
Reference in New Issue
Block a user