diff options
Diffstat (limited to 'drivers/macintosh')
-rw-r--r-- | drivers/macintosh/therm_adt746x.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/drivers/macintosh/therm_adt746x.c b/drivers/macintosh/therm_adt746x.c index 54f4942a2968..5366dc93fb38 100644 --- a/drivers/macintosh/therm_adt746x.c +++ b/drivers/macintosh/therm_adt746x.c | |||
@@ -562,18 +562,24 @@ thermostat_init(void) | |||
562 | therm_type = ADT7460; | 562 | therm_type = ADT7460; |
563 | else if (of_device_is_compatible(np, "adt7467")) | 563 | else if (of_device_is_compatible(np, "adt7467")) |
564 | therm_type = ADT7467; | 564 | therm_type = ADT7467; |
565 | else | 565 | else { |
566 | of_node_put(np); | ||
566 | return -ENODEV; | 567 | return -ENODEV; |
568 | } | ||
567 | 569 | ||
568 | prop = of_get_property(np, "hwsensor-params-version", NULL); | 570 | prop = of_get_property(np, "hwsensor-params-version", NULL); |
569 | printk(KERN_INFO "adt746x: version %d (%ssupported)\n", *prop, | 571 | printk(KERN_INFO "adt746x: version %d (%ssupported)\n", *prop, |
570 | (*prop == 1)?"":"un"); | 572 | (*prop == 1)?"":"un"); |
571 | if (*prop != 1) | 573 | if (*prop != 1) { |
574 | of_node_put(np); | ||
572 | return -ENODEV; | 575 | return -ENODEV; |
576 | } | ||
573 | 577 | ||
574 | prop = of_get_property(np, "reg", NULL); | 578 | prop = of_get_property(np, "reg", NULL); |
575 | if (!prop) | 579 | if (!prop) { |
580 | of_node_put(np); | ||
576 | return -ENODEV; | 581 | return -ENODEV; |
582 | } | ||
577 | 583 | ||
578 | /* look for bus either by path or using "reg" */ | 584 | /* look for bus either by path or using "reg" */ |
579 | if (strstr(np->full_name, "/i2c-bus@") != NULL) { | 585 | if (strstr(np->full_name, "/i2c-bus@") != NULL) { |
@@ -610,6 +616,7 @@ thermostat_init(void) | |||
610 | 616 | ||
611 | if (of_dev == NULL) { | 617 | if (of_dev == NULL) { |
612 | printk(KERN_ERR "Can't register temperatures device !\n"); | 618 | printk(KERN_ERR "Can't register temperatures device !\n"); |
619 | of_node_put(np); | ||
613 | return -ENODEV; | 620 | return -ENODEV; |
614 | } | 621 | } |
615 | 622 | ||