diff options
Diffstat (limited to 'drivers/mtd/maps/pcmciamtd.c')
-rw-r--r-- | drivers/mtd/maps/pcmciamtd.c | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/drivers/mtd/maps/pcmciamtd.c b/drivers/mtd/maps/pcmciamtd.c index e9086f0cb2fa..466f558aa7ed 100644 --- a/drivers/mtd/maps/pcmciamtd.c +++ b/drivers/mtd/maps/pcmciamtd.c | |||
@@ -487,7 +487,7 @@ static void card_settings(struct pcmciamtd_dev *dev, struct pcmcia_device *link, | |||
487 | #define CS_CHECK(fn, ret) \ | 487 | #define CS_CHECK(fn, ret) \ |
488 | do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) | 488 | do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) |
489 | 489 | ||
490 | static void pcmciamtd_config(struct pcmcia_device *link) | 490 | static int pcmciamtd_config(struct pcmcia_device *link) |
491 | { | 491 | { |
492 | struct pcmciamtd_dev *dev = link->priv; | 492 | struct pcmciamtd_dev *dev = link->priv; |
493 | struct mtd_info *mtd = NULL; | 493 | struct mtd_info *mtd = NULL; |
@@ -561,7 +561,7 @@ static void pcmciamtd_config(struct pcmcia_device *link) | |||
561 | if(!dev->win_size) { | 561 | if(!dev->win_size) { |
562 | err("Cant allocate memory window"); | 562 | err("Cant allocate memory window"); |
563 | pcmciamtd_release(link); | 563 | pcmciamtd_release(link); |
564 | return; | 564 | return -ENODEV; |
565 | } | 565 | } |
566 | DEBUG(1, "Allocated a window of %dKiB", dev->win_size >> 10); | 566 | DEBUG(1, "Allocated a window of %dKiB", dev->win_size >> 10); |
567 | 567 | ||
@@ -573,7 +573,7 @@ static void pcmciamtd_config(struct pcmcia_device *link) | |||
573 | if(!dev->win_base) { | 573 | if(!dev->win_base) { |
574 | err("ioremap(%lu, %u) failed", req.Base, req.Size); | 574 | err("ioremap(%lu, %u) failed", req.Base, req.Size); |
575 | pcmciamtd_release(link); | 575 | pcmciamtd_release(link); |
576 | return; | 576 | return -ENODEV; |
577 | } | 577 | } |
578 | DEBUG(1, "mapped window dev = %p req.base = 0x%lx base = %p size = 0x%x", | 578 | DEBUG(1, "mapped window dev = %p req.base = 0x%lx base = %p size = 0x%x", |
579 | dev, req.Base, dev->win_base, req.Size); | 579 | dev, req.Base, dev->win_base, req.Size); |
@@ -605,6 +605,7 @@ static void pcmciamtd_config(struct pcmcia_device *link) | |||
605 | ret = pcmcia_request_configuration(link, &link->conf); | 605 | ret = pcmcia_request_configuration(link, &link->conf); |
606 | if(ret != CS_SUCCESS) { | 606 | if(ret != CS_SUCCESS) { |
607 | cs_error(link, RequestConfiguration, ret); | 607 | cs_error(link, RequestConfiguration, ret); |
608 | return -ENODEV; | ||
608 | } | 609 | } |
609 | 610 | ||
610 | if(mem_type == 1) { | 611 | if(mem_type == 1) { |
@@ -625,7 +626,7 @@ static void pcmciamtd_config(struct pcmcia_device *link) | |||
625 | if(!mtd) { | 626 | if(!mtd) { |
626 | DEBUG(1, "Cant find an MTD"); | 627 | DEBUG(1, "Cant find an MTD"); |
627 | pcmciamtd_release(link); | 628 | pcmciamtd_release(link); |
628 | return; | 629 | return -ENODEV; |
629 | } | 630 | } |
630 | 631 | ||
631 | dev->mtd_info = mtd; | 632 | dev->mtd_info = mtd; |
@@ -668,19 +669,19 @@ static void pcmciamtd_config(struct pcmcia_device *link) | |||
668 | dev->mtd_info = NULL; | 669 | dev->mtd_info = NULL; |
669 | err("Couldnt register MTD device"); | 670 | err("Couldnt register MTD device"); |
670 | pcmciamtd_release(link); | 671 | pcmciamtd_release(link); |
671 | return; | 672 | return -ENODEV; |
672 | } | 673 | } |
673 | snprintf(dev->node.dev_name, sizeof(dev->node.dev_name), "mtd%d", mtd->index); | 674 | snprintf(dev->node.dev_name, sizeof(dev->node.dev_name), "mtd%d", mtd->index); |
674 | info("mtd%d: %s", mtd->index, mtd->name); | 675 | info("mtd%d: %s", mtd->index, mtd->name); |
675 | link->state &= ~DEV_CONFIG_PENDING; | 676 | link->state &= ~DEV_CONFIG_PENDING; |
676 | link->dev_node = &dev->node; | 677 | link->dev_node = &dev->node; |
677 | return; | 678 | return 0; |
678 | 679 | ||
679 | cs_failed: | 680 | cs_failed: |
680 | cs_error(link, last_fn, last_ret); | 681 | cs_error(link, last_fn, last_ret); |
681 | err("CS Error, exiting"); | 682 | err("CS Error, exiting"); |
682 | pcmciamtd_release(link); | 683 | pcmciamtd_release(link); |
683 | return; | 684 | return -ENODEV; |
684 | } | 685 | } |
685 | 686 | ||
686 | 687 | ||
@@ -730,7 +731,7 @@ static void pcmciamtd_detach(struct pcmcia_device *link) | |||
730 | * with Card Services. | 731 | * with Card Services. |
731 | */ | 732 | */ |
732 | 733 | ||
733 | static int pcmciamtd_attach(struct pcmcia_device *link) | 734 | static int pcmciamtd_probe(struct pcmcia_device *link) |
734 | { | 735 | { |
735 | struct pcmciamtd_dev *dev; | 736 | struct pcmciamtd_dev *dev; |
736 | 737 | ||
@@ -747,9 +748,7 @@ static int pcmciamtd_attach(struct pcmcia_device *link) | |||
747 | link->conf.IntType = INT_MEMORY; | 748 | link->conf.IntType = INT_MEMORY; |
748 | 749 | ||
749 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; | 750 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; |
750 | pcmciamtd_config(link); | 751 | return pcmciamtd_config(link); |
751 | |||
752 | return 0; | ||
753 | } | 752 | } |
754 | 753 | ||
755 | static struct pcmcia_device_id pcmciamtd_ids[] = { | 754 | static struct pcmcia_device_id pcmciamtd_ids[] = { |
@@ -783,7 +782,7 @@ static struct pcmcia_driver pcmciamtd_driver = { | |||
783 | .drv = { | 782 | .drv = { |
784 | .name = "pcmciamtd" | 783 | .name = "pcmciamtd" |
785 | }, | 784 | }, |
786 | .probe = pcmciamtd_attach, | 785 | .probe = pcmciamtd_probe, |
787 | .remove = pcmciamtd_detach, | 786 | .remove = pcmciamtd_detach, |
788 | .owner = THIS_MODULE, | 787 | .owner = THIS_MODULE, |
789 | .id_table = pcmciamtd_ids, | 788 | .id_table = pcmciamtd_ids, |