diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2018-11-07 14:39:07 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2018-11-07 14:39:07 -0500 |
commit | 85758777c2a227fd1541b6dd122a08ab79c347ce (patch) | |
tree | 1f52f796f6d59ddd5234a446e036e5f8c8d7e9e0 | |
parent | e09d51adfbb110ee1d4af3571b8cb67b0f938756 (diff) | |
parent | e3e61f01d755188cb6c2dcf5a244b9c0937c258e (diff) |
Merge tag 'hwmon-for-v4.20-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging
Pull hwmon fixes from Guenter Roeck:
- Remove bogus __init annotations in ibmpowernv driver
- Fix double-free in error handling of __hwmon_device_register()
* tag 'hwmon-for-v4.20-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging:
hwmon: (ibmpowernv) Remove bogus __init annotations
hwmon: (core) Fix double-free in __hwmon_device_register()
-rw-r--r-- | drivers/hwmon/hwmon.c | 8 | ||||
-rw-r--r-- | drivers/hwmon/ibmpowernv.c | 7 |
2 files changed, 7 insertions, 8 deletions
diff --git a/drivers/hwmon/hwmon.c b/drivers/hwmon/hwmon.c index 975c95169884..84f61cec6319 100644 --- a/drivers/hwmon/hwmon.c +++ b/drivers/hwmon/hwmon.c | |||
@@ -649,8 +649,10 @@ __hwmon_device_register(struct device *dev, const char *name, void *drvdata, | |||
649 | if (info[i]->config[j] & HWMON_T_INPUT) { | 649 | if (info[i]->config[j] & HWMON_T_INPUT) { |
650 | err = hwmon_thermal_add_sensor(dev, | 650 | err = hwmon_thermal_add_sensor(dev, |
651 | hwdev, j); | 651 | hwdev, j); |
652 | if (err) | 652 | if (err) { |
653 | goto free_device; | 653 | device_unregister(hdev); |
654 | goto ida_remove; | ||
655 | } | ||
654 | } | 656 | } |
655 | } | 657 | } |
656 | } | 658 | } |
@@ -658,8 +660,6 @@ __hwmon_device_register(struct device *dev, const char *name, void *drvdata, | |||
658 | 660 | ||
659 | return hdev; | 661 | return hdev; |
660 | 662 | ||
661 | free_device: | ||
662 | device_unregister(hdev); | ||
663 | free_hwmon: | 663 | free_hwmon: |
664 | kfree(hwdev); | 664 | kfree(hwdev); |
665 | ida_remove: | 665 | ida_remove: |
diff --git a/drivers/hwmon/ibmpowernv.c b/drivers/hwmon/ibmpowernv.c index 0ccca87f5271..293dd1c6c7b3 100644 --- a/drivers/hwmon/ibmpowernv.c +++ b/drivers/hwmon/ibmpowernv.c | |||
@@ -181,7 +181,7 @@ static ssize_t show_label(struct device *dev, struct device_attribute *devattr, | |||
181 | return sprintf(buf, "%s\n", sdata->label); | 181 | return sprintf(buf, "%s\n", sdata->label); |
182 | } | 182 | } |
183 | 183 | ||
184 | static int __init get_logical_cpu(int hwcpu) | 184 | static int get_logical_cpu(int hwcpu) |
185 | { | 185 | { |
186 | int cpu; | 186 | int cpu; |
187 | 187 | ||
@@ -192,9 +192,8 @@ static int __init get_logical_cpu(int hwcpu) | |||
192 | return -ENOENT; | 192 | return -ENOENT; |
193 | } | 193 | } |
194 | 194 | ||
195 | static void __init make_sensor_label(struct device_node *np, | 195 | static void make_sensor_label(struct device_node *np, |
196 | struct sensor_data *sdata, | 196 | struct sensor_data *sdata, const char *label) |
197 | const char *label) | ||
198 | { | 197 | { |
199 | u32 id; | 198 | u32 id; |
200 | size_t n; | 199 | size_t n; |