diff options
author | Johannes Thumshirn <johannes.thumshirn@men.de> | 2015-01-12 10:26:32 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2015-02-03 18:48:51 -0500 |
commit | a48742bce1011d2109f6d6cbda00445aee049fd4 (patch) | |
tree | 39191dfa9b502119ddf9caa45a414486817232a2 | |
parent | d909f4315b99e5743041eeb01a2552fcbb125c89 (diff) |
mcb: Fix error path of mcb_pci_probe
If a MCB PCI Carrier device is IO mapped insted of memory-mapped (which is
currently unsupported by the upstream driver) the probe function bails out
with -ENOTSUPP.
In this case the memory of the PCI device was not unmapped.
Also rename error label to reflect what will happen at the destination (suggested
by Julia Lawall <julia.lawall@lip6.fr>.
Signed-off-by: Johannes Thumshirn <johannes.thumshirn@men.de>
Reported-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/mcb/mcb-pci.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/drivers/mcb/mcb-pci.c b/drivers/mcb/mcb-pci.c index 5e1bd5db02c8..0af7361e377f 100644 --- a/drivers/mcb/mcb-pci.c +++ b/drivers/mcb/mcb-pci.c | |||
@@ -51,7 +51,7 @@ static int mcb_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) | |||
51 | priv->mapbase = pci_resource_start(pdev, 0); | 51 | priv->mapbase = pci_resource_start(pdev, 0); |
52 | if (!priv->mapbase) { | 52 | if (!priv->mapbase) { |
53 | dev_err(&pdev->dev, "No PCI resource\n"); | 53 | dev_err(&pdev->dev, "No PCI resource\n"); |
54 | goto err_start; | 54 | goto out_disable; |
55 | } | 55 | } |
56 | 56 | ||
57 | res = request_mem_region(priv->mapbase, CHAM_HEADER_SIZE, | 57 | res = request_mem_region(priv->mapbase, CHAM_HEADER_SIZE, |
@@ -59,14 +59,14 @@ static int mcb_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) | |||
59 | if (IS_ERR(res)) { | 59 | if (IS_ERR(res)) { |
60 | dev_err(&pdev->dev, "Failed to request PCI memory\n"); | 60 | dev_err(&pdev->dev, "Failed to request PCI memory\n"); |
61 | ret = PTR_ERR(res); | 61 | ret = PTR_ERR(res); |
62 | goto err_start; | 62 | goto out_disable; |
63 | } | 63 | } |
64 | 64 | ||
65 | priv->base = ioremap(priv->mapbase, CHAM_HEADER_SIZE); | 65 | priv->base = ioremap(priv->mapbase, CHAM_HEADER_SIZE); |
66 | if (!priv->base) { | 66 | if (!priv->base) { |
67 | dev_err(&pdev->dev, "Cannot ioremap\n"); | 67 | dev_err(&pdev->dev, "Cannot ioremap\n"); |
68 | ret = -ENOMEM; | 68 | ret = -ENOMEM; |
69 | goto err_ioremap; | 69 | goto out_release; |
70 | } | 70 | } |
71 | 71 | ||
72 | flags = pci_resource_flags(pdev, 0); | 72 | flags = pci_resource_flags(pdev, 0); |
@@ -74,7 +74,7 @@ static int mcb_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) | |||
74 | ret = -ENOTSUPP; | 74 | ret = -ENOTSUPP; |
75 | dev_err(&pdev->dev, | 75 | dev_err(&pdev->dev, |
76 | "IO mapped PCI devices are not supported\n"); | 76 | "IO mapped PCI devices are not supported\n"); |
77 | goto err_ioremap; | 77 | goto out_release; |
78 | } | 78 | } |
79 | 79 | ||
80 | pci_set_drvdata(pdev, priv); | 80 | pci_set_drvdata(pdev, priv); |
@@ -82,14 +82,14 @@ static int mcb_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) | |||
82 | priv->bus = mcb_alloc_bus(&pdev->dev); | 82 | priv->bus = mcb_alloc_bus(&pdev->dev); |
83 | if (IS_ERR(priv->bus)) { | 83 | if (IS_ERR(priv->bus)) { |
84 | ret = PTR_ERR(priv->bus); | 84 | ret = PTR_ERR(priv->bus); |
85 | goto err_drvdata; | 85 | goto out_iounmap; |
86 | } | 86 | } |
87 | 87 | ||
88 | priv->bus->get_irq = mcb_pci_get_irq; | 88 | priv->bus->get_irq = mcb_pci_get_irq; |
89 | 89 | ||
90 | ret = chameleon_parse_cells(priv->bus, priv->mapbase, priv->base); | 90 | ret = chameleon_parse_cells(priv->bus, priv->mapbase, priv->base); |
91 | if (ret < 0) | 91 | if (ret < 0) |
92 | goto err_drvdata; | 92 | goto out_iounmap; |
93 | num_cells = ret; | 93 | num_cells = ret; |
94 | 94 | ||
95 | dev_dbg(&pdev->dev, "Found %d cells\n", num_cells); | 95 | dev_dbg(&pdev->dev, "Found %d cells\n", num_cells); |
@@ -98,11 +98,11 @@ static int mcb_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) | |||
98 | 98 | ||
99 | return 0; | 99 | return 0; |
100 | 100 | ||
101 | err_drvdata: | 101 | out_iounmap: |
102 | iounmap(priv->base); | 102 | iounmap(priv->base); |
103 | err_ioremap: | 103 | out_release: |
104 | pci_release_region(pdev, 0); | 104 | pci_release_region(pdev, 0); |
105 | err_start: | 105 | out_disable: |
106 | pci_disable_device(pdev); | 106 | pci_disable_device(pdev); |
107 | return ret; | 107 | return ret; |
108 | } | 108 | } |