Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mmc: cavium: Add missed pci_release_regions

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>
Link: https://lore.kernel.org/r/20191206075408.18355-1-hslester96@gmail.com
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>

authored by

Chuhong Yuan and committed by
Ulf Hansson
f630d011 4edf6f70

+11 -5
+11 -5
drivers/mmc/host/cavium-thunderx.c
··· 76 76 return ret; 77 77 78 78 host->base = pcim_iomap(pdev, 0, pci_resource_len(pdev, 0)); 79 - if (!host->base) 80 - return -EINVAL; 79 + if (!host->base) { 80 + ret = -EINVAL; 81 + goto error; 82 + } 81 83 82 84 /* On ThunderX these are identical */ 83 85 host->dma_base = host->base; ··· 88 86 host->reg_off_dma = 0x160; 89 87 90 88 host->clk = devm_clk_get(dev, NULL); 91 - if (IS_ERR(host->clk)) 92 - return PTR_ERR(host->clk); 89 + if (IS_ERR(host->clk)) { 90 + ret = PTR_ERR(host->clk); 91 + goto error; 92 + } 93 93 94 94 ret = clk_prepare_enable(host->clk); 95 95 if (ret) 96 - return ret; 96 + goto error; 97 97 host->sys_freq = clk_get_rate(host->clk); 98 98 99 99 spin_lock_init(&host->irq_handler_lock); ··· 161 157 } 162 158 } 163 159 clk_disable_unprepare(host->clk); 160 + pci_release_regions(pdev); 164 161 return ret; 165 162 } 166 163 ··· 180 175 writeq(dma_cfg, host->dma_base + MIO_EMM_DMA_CFG(host)); 181 176 182 177 clk_disable_unprepare(host->clk); 178 + pci_release_regions(pdev); 183 179 } 184 180 185 181 static const struct pci_device_id thunder_mmc_id_table[] = {