hc
2023-12-11 d2ccde1c8e90d38cee87a1b0309ad2827f3fd30d
kernel/drivers/mmc/host/cavium-thunderx.c
....@@ -76,8 +76,10 @@
7676 return ret;
7777
7878 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
+ }
8183
8284 /* On ThunderX these are identical */
8385 host->dma_base = host->base;
....@@ -86,12 +88,14 @@
8688 host->reg_off_dma = 0x160;
8789
8890 host->clk = devm_clk_get(dev, NULL);
89
- if (IS_ERR(host->clk))
90
- return PTR_ERR(host->clk);
91
+ if (IS_ERR(host->clk)) {
92
+ ret = PTR_ERR(host->clk);
93
+ goto error;
94
+ }
9195
9296 ret = clk_prepare_enable(host->clk);
9397 if (ret)
94
- return ret;
98
+ goto error;
9599 host->sys_freq = clk_get_rate(host->clk);
96100
97101 spin_lock_init(&host->irq_handler_lock);
....@@ -138,8 +142,10 @@
138142 continue;
139143
140144 ret = cvm_mmc_of_slot_probe(&host->slot_pdev[i]->dev, host);
141
- if (ret)
145
+ if (ret) {
146
+ of_node_put(child_node);
142147 goto error;
148
+ }
143149 }
144150 i++;
145151 }
....@@ -157,6 +163,7 @@
157163 }
158164 }
159165 clk_disable_unprepare(host->clk);
166
+ pci_release_regions(pdev);
160167 return ret;
161168 }
162169
....@@ -175,6 +182,7 @@
175182 writeq(dma_cfg, host->dma_base + MIO_EMM_DMA_CFG(host));
176183
177184 clk_disable_unprepare(host->clk);
185
+ pci_release_regions(pdev);
178186 }
179187
180188 static const struct pci_device_id thunder_mmc_id_table[] = {