Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'hwmon-for-v6.19-take-2' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging

Pull hwmon fixes Guenter Roeck:

- Documentation: Fix link to g762 devicetree binding

- emc2305: Fix devicetree refcount leak and double put

- dell-smm: Fix channel-index off-by-one error

- w83791d: Convert macros to functions to avoid TOCTOU

* tag 'hwmon-for-v6.19-take-2' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging:
docs: hwmon: fix link to g762 devicetree binding
hwmon: (emc2305) fix device node refcount leak in error path
hwmon: (emc2305) fix double put in emc2305_probe_childs_from_dt
hwmon: (dell-smm) Fix off-by-one error in dell_smm_is_visible()
hwmon: (w83791d) Convert macros to functions to avoid TOCTOU

+19 -14
+1 -1
Documentation/hwmon/g762.rst
··· 17 17 Note that those entries do not provide ways to setup the specific 18 18 hardware characteristics of the system (reference clock, pulses per 19 19 fan revolution, ...); Those can be modified via devicetree bindings 20 - documented in Documentation/devicetree/bindings/hwmon/g762.txt or 20 + documented in Documentation/devicetree/bindings/hwmon/gmt,g762.yaml or 21 21 using a specific platform_data structure in board initialization 22 22 file (see include/linux/platform_data/g762.h). 23 23
+2 -2
drivers/hwmon/dell-smm-hwmon.c
··· 861 861 if (auto_fan) { 862 862 /* 863 863 * The setting affects all fans, so only create a 864 - * single attribute. 864 + * single attribute for the first fan channel. 865 865 */ 866 - if (channel != 1) 866 + if (channel != 0) 867 867 return 0; 868 868 869 869 /*
+4 -4
drivers/hwmon/emc2305.c
··· 593 593 for_each_child_of_node(dev->of_node, child) { 594 594 if (of_property_present(child, "reg")) { 595 595 ret = emc2305_of_parse_pwm_child(dev, child, data); 596 - if (ret) { 597 - of_node_put(child); 596 + if (ret) 598 597 continue; 599 - } 600 598 count++; 601 599 } 602 600 } ··· 683 685 i = 0; 684 686 for_each_child_of_node(dev->of_node, child) { 685 687 ret = emc2305_set_single_tz(dev, child, i); 686 - if (ret != 0) 688 + if (ret != 0) { 689 + of_node_put(child); 687 690 return ret; 691 + } 688 692 i++; 689 693 } 690 694 } else {
+12 -7
drivers/hwmon/w83791d.c
··· 218 218 return clamp_val((1350000 + rpm * div / 2) / (rpm * div), 1, 254); 219 219 } 220 220 221 - #define FAN_FROM_REG(val, div) ((val) == 0 ? -1 : \ 222 - ((val) == 255 ? 0 : \ 223 - 1350000 / ((val) * (div)))) 221 + static int fan_from_reg(int val, int div) 222 + { 223 + if (val == 0) 224 + return -1; 225 + if (val == 255) 226 + return 0; 227 + return 1350000 / (val * div); 228 + } 224 229 225 230 /* for temp1 which is 8-bit resolution, LSB = 1 degree Celsius */ 226 231 #define TEMP1_FROM_REG(val) ((val) * 1000) ··· 526 521 struct w83791d_data *data = w83791d_update_device(dev); \ 527 522 int nr = sensor_attr->index; \ 528 523 return sprintf(buf, "%d\n", \ 529 - FAN_FROM_REG(data->reg[nr], DIV_FROM_REG(data->fan_div[nr]))); \ 524 + fan_from_reg(data->reg[nr], DIV_FROM_REG(data->fan_div[nr]))); \ 530 525 } 531 526 532 527 show_fan_reg(fan); ··· 590 585 if (err) 591 586 return err; 592 587 593 - /* Save fan_min */ 594 - min = FAN_FROM_REG(data->fan_min[nr], DIV_FROM_REG(data->fan_div[nr])); 595 - 596 588 mutex_lock(&data->update_lock); 589 + /* Save fan_min */ 590 + min = fan_from_reg(data->fan_min[nr], DIV_FROM_REG(data->fan_div[nr])); 591 + 597 592 data->fan_div[nr] = div_to_reg(nr, val); 598 593 599 594 switch (nr) {