提交 72d4dbe0 编写于 作者: V Vadim Pasternak 提交者: Yang Yingliang

hwmon: (pmbus/tps53679) Fix driver info initialization in probe routine

[ Upstream commit ff066653 ]

Fix tps53679_probe() by using dynamically allocated "pmbus_driver_info"
structure instead of static. Usage of static structures causes
overwritten of the field "vrm_version", in case the system is equipped
with several tps53679 devices with the different "vrm_version".
In such case the last probed device overwrites this field for all
others.

Fixes: 61052652 ("hwmon: (pmbus) Add support for Texas Instruments tps53679 device")
Signed-off-by: NVadim Pasternak <vadimp@mellanox.com>
Signed-off-by: NGuenter Roeck <linux@roeck-us.net>
Signed-off-by: NSasha Levin <sashal@kernel.org>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 01d65ddb
...@@ -80,7 +80,14 @@ static struct pmbus_driver_info tps53679_info = { ...@@ -80,7 +80,14 @@ static struct pmbus_driver_info tps53679_info = {
static int tps53679_probe(struct i2c_client *client, static int tps53679_probe(struct i2c_client *client,
const struct i2c_device_id *id) const struct i2c_device_id *id)
{ {
return pmbus_do_probe(client, id, &tps53679_info); struct pmbus_driver_info *info;
info = devm_kmemdup(&client->dev, &tps53679_info, sizeof(*info),
GFP_KERNEL);
if (!info)
return -ENOMEM;
return pmbus_do_probe(client, id, info);
} }
static const struct i2c_device_id tps53679_id[] = { static const struct i2c_device_id tps53679_id[] = {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册