mirror of
https://github.com/torvalds/linux.git
synced 2024-11-17 01:22:07 +00:00
Fix resource leak as well as broken store function in emc1403 driver,
and add support for additional chip revisions. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAABAgAGBQJTcXxbAAoJEMsfJm/On5mBRnIP/1VpgOIpha1dmPTazzRh+Yfn OCCsMQ3zWOqWfaEUnlih3QCJYI8HlXNQUoCbRAQnTzjEu+ryw8hk4o7mwEHYNRjI GMtXGsyRicEhzOqxHxburco21MHHFuTClDJAQ1TU3m6F502eCO74GoT3lYwhRnzD Cy3r9xtum6XohoTtYFagB3X3Fn5uzQAI1v1qlUM6omIHVQVS99q1VSRdQDqPYwq5 GubR728Kwbk2JP4oBh6G1Jg0kMw2b/H32HDGCY4Wxyrw3WTHw9dH7k3nXqMTvlpQ NYGdH+yaC0cRceB7cahWemXw7rwlqxcGRuCah5jo0Wo20v+CT4wohK1Vg1K5MMI/ xb51j1cUuP3VikonewoYRBXz5vd68a47+EmIwklr7IWJ4W0SJ0pBJXtJFeqOh7M7 iTEwR7vzuV5stam4pRX1tLB60pbcDI83mk1sXpIFcRp9prOFHI7m2ubWbWKPOn2T TBUGmy6cn+GyAfmaky7vNtT7vnIi+7SV9Ff7lqpZsrC+qEv5tdO94KQOwBwWfMnS vWiw5LTIQ2qtFqYQQ2tLctXquVV2xo0XrDDzCwi/V2LfAuTEyJi9ytPeJrOR2pbe qb1H2pe/80OZ6DrHZsjzTsLDYT+YBElaC6n1H7aGNdwzaDimb9E4GjG5P0dwxM81 IuBptyzDzS/glnNqohgI =PVvi -----END PGP SIGNATURE----- Merge tag 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging Pull hwmon fixes from Guenter Roeck: "Fix resource leak as well as broken store function in emc1403 driver, and add support for additional chip revisions" * tag 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging: hwmon: (emc1403) Support full range of known chip revision numbers hwmon: (emc1403) Fix resource leak on module unload hwmon: (emc1403) fix inverted store_hyst()
This commit is contained in:
commit
77d92784b4
@ -163,7 +163,7 @@ static ssize_t store_hyst(struct device *dev,
|
||||
if (retval < 0)
|
||||
goto fail;
|
||||
|
||||
hyst = val - retval * 1000;
|
||||
hyst = retval * 1000 - val;
|
||||
hyst = DIV_ROUND_CLOSEST(hyst, 1000);
|
||||
if (hyst < 0 || hyst > 255) {
|
||||
retval = -ERANGE;
|
||||
@ -330,7 +330,7 @@ static int emc1403_detect(struct i2c_client *client,
|
||||
}
|
||||
|
||||
id = i2c_smbus_read_byte_data(client, THERMAL_REVISION_REG);
|
||||
if (id != 0x01)
|
||||
if (id < 0x01 || id > 0x04)
|
||||
return -ENODEV;
|
||||
|
||||
return 0;
|
||||
@ -355,9 +355,9 @@ static int emc1403_probe(struct i2c_client *client,
|
||||
if (id->driver_data)
|
||||
data->groups[1] = &emc1404_group;
|
||||
|
||||
hwmon_dev = hwmon_device_register_with_groups(&client->dev,
|
||||
client->name, data,
|
||||
data->groups);
|
||||
hwmon_dev = devm_hwmon_device_register_with_groups(&client->dev,
|
||||
client->name, data,
|
||||
data->groups);
|
||||
if (IS_ERR(hwmon_dev))
|
||||
return PTR_ERR(hwmon_dev);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user