aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/hwmon.c
diff options
context:
space:
mode:
authorJean Delvare <khali@linux-fr.org>2012-12-19 16:16:59 -0500
committerJean Delvare <khali@endymion.delvare>2012-12-19 16:16:59 -0500
commitd6dab7dd123ba6a737e69d89c8cca9c6d9b75aa9 (patch)
tree64ecfc90d3bca65fe952c6dd5f10ac1341f7a2a8 /drivers/hwmon/hwmon.c
parent752451f01c4567b506bf4343082682dbb8fb30dd (diff)
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>
Diffstat (limited to 'drivers/hwmon/hwmon.c')
-rw-r--r--drivers/hwmon/hwmon.c26
1 files changed, 14 insertions, 12 deletions
diff --git a/drivers/hwmon/hwmon.c b/drivers/hwmon/hwmon.c
index c3c471ca202f..646314f7c839 100644
--- a/drivers/hwmon/hwmon.c
+++ b/drivers/hwmon/hwmon.c
@@ -84,19 +84,21 @@ static void __init hwmon_pci_quirks(void)
84 84
85 /* Open access to 0x295-0x296 on MSI MS-7031 */ 85 /* Open access to 0x295-0x296 on MSI MS-7031 */
86 sb = pci_get_device(PCI_VENDOR_ID_ATI, 0x436c, NULL); 86 sb = pci_get_device(PCI_VENDOR_ID_ATI, 0x436c, NULL);
87 if (sb && 87 if (sb) {
88 (sb->subsystem_vendor == 0x1462 && /* MSI */ 88 if (sb->subsystem_vendor == 0x1462 && /* MSI */
89 sb->subsystem_device == 0x0031)) { /* MS-7031 */ 89 sb->subsystem_device == 0x0031) { /* MS-7031 */
90 90 pci_read_config_byte(sb, 0x48, &enable);
91 pci_read_config_byte(sb, 0x48, &enable); 91 pci_read_config_word(sb, 0x64, &base);
92 pci_read_config_word(sb, 0x64, &base); 92
93 93 if (base == 0 && !(enable & BIT(2))) {
94 if (base == 0 && !(enable & BIT(2))) { 94 dev_info(&sb->dev,
95 dev_info(&sb->dev, 95 "Opening wide generic port at 0x295\n");
96 "Opening wide generic port at 0x295\n"); 96 pci_write_config_word(sb, 0x64, 0x295);
97 pci_write_config_word(sb, 0x64, 0x295); 97 pci_write_config_byte(sb, 0x48,
98 pci_write_config_byte(sb, 0x48, enable | BIT(2)); 98 enable | BIT(2));
99 }
99 } 100 }
101 pci_dev_put(sb);
100 } 102 }
101#endif 103#endif
102} 104}