aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/macintosh
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/macintosh')
-rw-r--r--drivers/macintosh/mediabay.c7
-rw-r--r--drivers/macintosh/smu.c5
-rw-r--r--drivers/macintosh/therm_adt746x.c13
3 files changed, 18 insertions, 7 deletions
diff --git a/drivers/macintosh/mediabay.c b/drivers/macintosh/mediabay.c
index 82add26cc665..818aba368541 100644
--- a/drivers/macintosh/mediabay.c
+++ b/drivers/macintosh/mediabay.c
@@ -84,7 +84,7 @@ struct media_bay_info {
84 int cd_irq; 84 int cd_irq;
85 int cd_retry; 85 int cd_retry;
86#endif 86#endif
87#if defined(CONFIG_BLK_DEV_IDE_PMAC) || defined(CONFIG_MAC_FLOPPY) 87#if defined(CONFIG_BLK_DEV_IDE_PMAC)
88 int cd_index; 88 int cd_index;
89#endif 89#endif
90}; 90};
@@ -417,6 +417,7 @@ static void poll_media_bay(struct media_bay_info* bay)
417 } 417 }
418} 418}
419 419
420#ifdef CONFIG_BLK_DEV_IDE_PMAC
420int check_media_bay(struct device_node *which_bay, int what) 421int check_media_bay(struct device_node *which_bay, int what)
421{ 422{
422 int i; 423 int i;
@@ -432,7 +433,6 @@ int check_media_bay(struct device_node *which_bay, int what)
432} 433}
433EXPORT_SYMBOL(check_media_bay); 434EXPORT_SYMBOL(check_media_bay);
434 435
435#ifdef CONFIG_BLK_DEV_IDE_PMAC
436int check_media_bay_by_base(unsigned long base, int what) 436int check_media_bay_by_base(unsigned long base, int what)
437{ 437{
438 int i; 438 int i;
@@ -556,7 +556,8 @@ static void media_bay_step(int i)
556 printk("mediabay %d, registering IDE...\n", i); 556 printk("mediabay %d, registering IDE...\n", i);
557 pmu_suspend(); 557 pmu_suspend();
558 ide_port_scan(bay->cd_port); 558 ide_port_scan(bay->cd_port);
559 bay->cd_index = bay->cd_port->index; 559 if (bay->cd_port->present)
560 bay->cd_index = bay->cd_port->index;
560 pmu_resume(); 561 pmu_resume();
561 } 562 }
562 if (bay->cd_index == -1) { 563 if (bay->cd_index == -1) {
diff --git a/drivers/macintosh/smu.c b/drivers/macintosh/smu.c
index 77ad192962c5..d86d57af282a 100644
--- a/drivers/macintosh/smu.c
+++ b/drivers/macintosh/smu.c
@@ -483,12 +483,15 @@ int __init smu_init (void)
483 483
484 if (smu_cmdbuf_abs == 0) { 484 if (smu_cmdbuf_abs == 0) {
485 printk(KERN_ERR "SMU: Command buffer not allocated !\n"); 485 printk(KERN_ERR "SMU: Command buffer not allocated !\n");
486 of_node_put(np);
486 return -EINVAL; 487 return -EINVAL;
487 } 488 }
488 489
489 smu = alloc_bootmem(sizeof(struct smu_device)); 490 smu = alloc_bootmem(sizeof(struct smu_device));
490 if (smu == NULL) 491 if (smu == NULL) {
492 of_node_put(np);
491 return -ENOMEM; 493 return -ENOMEM;
494 }
492 memset(smu, 0, sizeof(*smu)); 495 memset(smu, 0, sizeof(*smu));
493 496
494 spin_lock_init(&smu->lock); 497 spin_lock_init(&smu->lock);
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