* [PATCH] mmc: cavium: Add missed pci_release_regions
@ 2019-12-06 7:54 Chuhong Yuan
2019-12-18 14:01 ` Ulf Hansson
0 siblings, 1 reply; 2+ messages in thread
From: Chuhong Yuan @ 2019-12-06 7:54 UTC (permalink / raw)
Cc: Jan Glauber, David Daney, Steven J . Hill, Ulf Hansson,
linux-mmc, linux-kernel, Chuhong Yuan
The driver forgets to call pci_release_regions() in probe failure
and remove.
Add the missed calls to fix it.
Signed-off-by: Chuhong Yuan <hslester96@gmail.com>
---
drivers/mmc/host/cavium-thunderx.c | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)
diff --git a/drivers/mmc/host/cavium-thunderx.c b/drivers/mmc/host/cavium-thunderx.c
index eee08d81b242..76013bbbcff3 100644
--- a/drivers/mmc/host/cavium-thunderx.c
+++ b/drivers/mmc/host/cavium-thunderx.c
@@ -76,8 +76,10 @@ static int thunder_mmc_probe(struct pci_dev *pdev,
return ret;
host->base = pcim_iomap(pdev, 0, pci_resource_len(pdev, 0));
- if (!host->base)
- return -EINVAL;
+ if (!host->base) {
+ ret = -EINVAL;
+ goto error;
+ }
/* On ThunderX these are identical */
host->dma_base = host->base;
@@ -86,12 +88,14 @@ static int thunder_mmc_probe(struct pci_dev *pdev,
host->reg_off_dma = 0x160;
host->clk = devm_clk_get(dev, NULL);
- if (IS_ERR(host->clk))
- return PTR_ERR(host->clk);
+ if (IS_ERR(host->clk)) {
+ ret = PTR_ERR(host->clk);
+ goto error;
+ }
ret = clk_prepare_enable(host->clk);
if (ret)
- return ret;
+ goto error;
host->sys_freq = clk_get_rate(host->clk);
spin_lock_init(&host->irq_handler_lock);
@@ -157,6 +161,7 @@ static int thunder_mmc_probe(struct pci_dev *pdev,
}
}
clk_disable_unprepare(host->clk);
+ pci_release_regions(pdev);
return ret;
}
@@ -175,6 +180,7 @@ static void thunder_mmc_remove(struct pci_dev *pdev)
writeq(dma_cfg, host->dma_base + MIO_EMM_DMA_CFG(host));
clk_disable_unprepare(host->clk);
+ pci_release_regions(pdev);
}
static const struct pci_device_id thunder_mmc_id_table[] = {
--
2.24.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] mmc: cavium: Add missed pci_release_regions
2019-12-06 7:54 [PATCH] mmc: cavium: Add missed pci_release_regions Chuhong Yuan
@ 2019-12-18 14:01 ` Ulf Hansson
0 siblings, 0 replies; 2+ messages in thread
From: Ulf Hansson @ 2019-12-18 14:01 UTC (permalink / raw)
To: Chuhong Yuan
Cc: Jan Glauber, David Daney, Steven J . Hill, linux-mmc,
Linux Kernel Mailing List
On Fri, 6 Dec 2019 at 08:54, Chuhong Yuan <hslester96@gmail.com> wrote:
>
> The driver forgets to call pci_release_regions() in probe failure
> and remove.
> Add the missed calls to fix it.
>
> Signed-off-by: Chuhong Yuan <hslester96@gmail.com>
Applied for next, thanks!
Kind regards
Uffe
> ---
> drivers/mmc/host/cavium-thunderx.c | 16 +++++++++++-----
> 1 file changed, 11 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/mmc/host/cavium-thunderx.c b/drivers/mmc/host/cavium-thunderx.c
> index eee08d81b242..76013bbbcff3 100644
> --- a/drivers/mmc/host/cavium-thunderx.c
> +++ b/drivers/mmc/host/cavium-thunderx.c
> @@ -76,8 +76,10 @@ static int thunder_mmc_probe(struct pci_dev *pdev,
> return ret;
>
> host->base = pcim_iomap(pdev, 0, pci_resource_len(pdev, 0));
> - if (!host->base)
> - return -EINVAL;
> + if (!host->base) {
> + ret = -EINVAL;
> + goto error;
> + }
>
> /* On ThunderX these are identical */
> host->dma_base = host->base;
> @@ -86,12 +88,14 @@ static int thunder_mmc_probe(struct pci_dev *pdev,
> host->reg_off_dma = 0x160;
>
> host->clk = devm_clk_get(dev, NULL);
> - if (IS_ERR(host->clk))
> - return PTR_ERR(host->clk);
> + if (IS_ERR(host->clk)) {
> + ret = PTR_ERR(host->clk);
> + goto error;
> + }
>
> ret = clk_prepare_enable(host->clk);
> if (ret)
> - return ret;
> + goto error;
> host->sys_freq = clk_get_rate(host->clk);
>
> spin_lock_init(&host->irq_handler_lock);
> @@ -157,6 +161,7 @@ static int thunder_mmc_probe(struct pci_dev *pdev,
> }
> }
> clk_disable_unprepare(host->clk);
> + pci_release_regions(pdev);
> return ret;
> }
>
> @@ -175,6 +180,7 @@ static void thunder_mmc_remove(struct pci_dev *pdev)
> writeq(dma_cfg, host->dma_base + MIO_EMM_DMA_CFG(host));
>
> clk_disable_unprepare(host->clk);
> + pci_release_regions(pdev);
> }
>
> static const struct pci_device_id thunder_mmc_id_table[] = {
> --
> 2.24.0
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-12-18 14:01 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-06 7:54 [PATCH] mmc: cavium: Add missed pci_release_regions Chuhong Yuan
2019-12-18 14:01 ` Ulf Hansson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).