Merge tag 'ext4_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso...
[linux-2.6-microblaze.git] / drivers / hwmon / coretemp.c
index 8bf32c6..9bee4d3 100644 (file)
@@ -242,10 +242,13 @@ static int adjust_tjmax(struct cpuinfo_x86 *c, u32 id, struct device *dev)
         */
        if (host_bridge && host_bridge->vendor == PCI_VENDOR_ID_INTEL) {
                for (i = 0; i < ARRAY_SIZE(tjmax_pci_table); i++) {
-                       if (host_bridge->device == tjmax_pci_table[i].device)
+                       if (host_bridge->device == tjmax_pci_table[i].device) {
+                               pci_dev_put(host_bridge);
                                return tjmax_pci_table[i].tjmax;
+                       }
                }
        }
+       pci_dev_put(host_bridge);
 
        for (i = 0; i < ARRAY_SIZE(tjmax_table); i++) {
                if (strstr(c->x86_model_id, tjmax_table[i].id))
@@ -533,6 +536,10 @@ static void coretemp_remove_core(struct platform_data *pdata, int indx)
 {
        struct temp_data *tdata = pdata->core_data[indx];
 
+       /* if we errored on add then this is already gone */
+       if (!tdata)
+               return;
+
        /* Remove the sysfs attributes */
        sysfs_remove_group(&pdata->hwmon_dev->kobj, &tdata->attr_group);