Commit d6dab7dd123ba6a737e69d89c8cca9c6d9b75aa9
Committed by
Jean Delvare
1 parent
752451f01c
Exists in
master
and in
20 other branches
hwmon: Fix PCI device reference leak in quirk
Thankfully this only affects systems with one specific south bridge and is most probably harmless unless the hwmon module is heavily cycled. Signed-off-by: Jean Delvare <khali@linux-fr.org> Acked-by: Guenter Roeck <linux@roeck-us.net>
Showing 1 changed file with 14 additions and 12 deletions Side-by-side Diff
drivers/hwmon/hwmon.c
... | ... | @@ -84,19 +84,21 @@ |
84 | 84 | |
85 | 85 | /* Open access to 0x295-0x296 on MSI MS-7031 */ |
86 | 86 | sb = pci_get_device(PCI_VENDOR_ID_ATI, 0x436c, NULL); |
87 | - if (sb && | |
88 | - (sb->subsystem_vendor == 0x1462 && /* MSI */ | |
89 | - sb->subsystem_device == 0x0031)) { /* MS-7031 */ | |
87 | + if (sb) { | |
88 | + if (sb->subsystem_vendor == 0x1462 && /* MSI */ | |
89 | + sb->subsystem_device == 0x0031) { /* MS-7031 */ | |
90 | + pci_read_config_byte(sb, 0x48, &enable); | |
91 | + pci_read_config_word(sb, 0x64, &base); | |
90 | 92 | |
91 | - pci_read_config_byte(sb, 0x48, &enable); | |
92 | - pci_read_config_word(sb, 0x64, &base); | |
93 | - | |
94 | - if (base == 0 && !(enable & BIT(2))) { | |
95 | - dev_info(&sb->dev, | |
96 | - "Opening wide generic port at 0x295\n"); | |
97 | - pci_write_config_word(sb, 0x64, 0x295); | |
98 | - pci_write_config_byte(sb, 0x48, enable | BIT(2)); | |
93 | + if (base == 0 && !(enable & BIT(2))) { | |
94 | + dev_info(&sb->dev, | |
95 | + "Opening wide generic port at 0x295\n"); | |
96 | + pci_write_config_word(sb, 0x64, 0x295); | |
97 | + pci_write_config_byte(sb, 0x48, | |
98 | + enable | BIT(2)); | |
99 | + } | |
99 | 100 | } |
101 | + pci_dev_put(sb); | |
100 | 102 | } |
101 | 103 | #endif |
102 | 104 | } |