diff options
author | Julia Lawall <julia@diku.dk> | 2011-08-10 04:47:16 -0400 |
---|---|---|
committer | Samuel Ortiz <sameo@linux.intel.com> | 2011-10-24 08:09:10 -0400 |
commit | 981c65a9b3e24029f64bd45c7a92f901899a033e (patch) | |
tree | d7e7c088ef1fdeca6ba8f53bef3fd4fc6c6555a2 /drivers/mfd/timberdale.c | |
parent | 54d8e2c323b439e0e20ea44d17b875d9a43f7d66 (diff) |
mfd: Clean timberdale error handling code up
In the first three cases, ioremap has been called, so iounmap is needed. A
new label for this is introduced, to differentiate it from err_msix, which
is the first point at which msix_entries actually needs to be freed.
Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'drivers/mfd/timberdale.c')
-rw-r--r-- | drivers/mfd/timberdale.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/mfd/timberdale.c b/drivers/mfd/timberdale.c index 696879e2eef7..02d65692ceb4 100644 --- a/drivers/mfd/timberdale.c +++ b/drivers/mfd/timberdale.c | |||
@@ -697,7 +697,7 @@ static int __devinit timb_probe(struct pci_dev *dev, | |||
697 | dev_err(&dev->dev, "The driver supports an older " | 697 | dev_err(&dev->dev, "The driver supports an older " |
698 | "version of the FPGA, please update the driver to " | 698 | "version of the FPGA, please update the driver to " |
699 | "support %d.%d\n", priv->fw.major, priv->fw.minor); | 699 | "support %d.%d\n", priv->fw.major, priv->fw.minor); |
700 | goto err_ioremap; | 700 | goto err_config; |
701 | } | 701 | } |
702 | if (priv->fw.major < TIMB_SUPPORTED_MAJOR || | 702 | if (priv->fw.major < TIMB_SUPPORTED_MAJOR || |
703 | priv->fw.minor < TIMB_REQUIRED_MINOR) { | 703 | priv->fw.minor < TIMB_REQUIRED_MINOR) { |
@@ -705,13 +705,13 @@ static int __devinit timb_probe(struct pci_dev *dev, | |||
705 | "please upgrade the FPGA to at least: %d.%d\n", | 705 | "please upgrade the FPGA to at least: %d.%d\n", |
706 | priv->fw.major, priv->fw.minor, | 706 | priv->fw.major, priv->fw.minor, |
707 | TIMB_SUPPORTED_MAJOR, TIMB_REQUIRED_MINOR); | 707 | TIMB_SUPPORTED_MAJOR, TIMB_REQUIRED_MINOR); |
708 | goto err_ioremap; | 708 | goto err_config; |
709 | } | 709 | } |
710 | 710 | ||
711 | msix_entries = kzalloc(TIMBERDALE_NR_IRQS * sizeof(*msix_entries), | 711 | msix_entries = kzalloc(TIMBERDALE_NR_IRQS * sizeof(*msix_entries), |
712 | GFP_KERNEL); | 712 | GFP_KERNEL); |
713 | if (!msix_entries) | 713 | if (!msix_entries) |
714 | goto err_ioremap; | 714 | goto err_config; |
715 | 715 | ||
716 | for (i = 0; i < TIMBERDALE_NR_IRQS; i++) | 716 | for (i = 0; i < TIMBERDALE_NR_IRQS; i++) |
717 | msix_entries[i].entry = i; | 717 | msix_entries[i].entry = i; |
@@ -825,6 +825,8 @@ err_mfd: | |||
825 | err_create_file: | 825 | err_create_file: |
826 | pci_disable_msix(dev); | 826 | pci_disable_msix(dev); |
827 | err_msix: | 827 | err_msix: |
828 | kfree(msix_entries); | ||
829 | err_config: | ||
828 | iounmap(priv->ctl_membase); | 830 | iounmap(priv->ctl_membase); |
829 | err_ioremap: | 831 | err_ioremap: |
830 | release_mem_region(priv->ctl_mapbase, CHIPCTLSIZE); | 832 | release_mem_region(priv->ctl_mapbase, CHIPCTLSIZE); |
@@ -833,7 +835,6 @@ err_request: | |||
833 | err_start: | 835 | err_start: |
834 | pci_disable_device(dev); | 836 | pci_disable_device(dev); |
835 | err_enable: | 837 | err_enable: |
836 | kfree(msix_entries); | ||
837 | kfree(priv); | 838 | kfree(priv); |
838 | pci_set_drvdata(dev, NULL); | 839 | pci_set_drvdata(dev, NULL); |
839 | return -ENODEV; | 840 | return -ENODEV; |