.. | .. |
---|
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; |
---|
.. | .. |
---|
86 | 88 | host->reg_off_dma = 0x160; |
---|
87 | 89 | |
---|
88 | 90 | 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 | + } |
---|
91 | 95 | |
---|
92 | 96 | ret = clk_prepare_enable(host->clk); |
---|
93 | 97 | if (ret) |
---|
94 | | - return ret; |
---|
| 98 | + goto error; |
---|
95 | 99 | host->sys_freq = clk_get_rate(host->clk); |
---|
96 | 100 | |
---|
97 | 101 | spin_lock_init(&host->irq_handler_lock); |
---|
.. | .. |
---|
138 | 142 | continue; |
---|
139 | 143 | |
---|
140 | 144 | ret = cvm_mmc_of_slot_probe(&host->slot_pdev[i]->dev, host); |
---|
141 | | - if (ret) |
---|
| 145 | + if (ret) { |
---|
| 146 | + of_node_put(child_node); |
---|
142 | 147 | goto error; |
---|
| 148 | + } |
---|
143 | 149 | } |
---|
144 | 150 | i++; |
---|
145 | 151 | } |
---|
.. | .. |
---|
157 | 163 | } |
---|
158 | 164 | } |
---|
159 | 165 | clk_disable_unprepare(host->clk); |
---|
| 166 | + pci_release_regions(pdev); |
---|
160 | 167 | return ret; |
---|
161 | 168 | } |
---|
162 | 169 | |
---|
.. | .. |
---|
175 | 182 | writeq(dma_cfg, host->dma_base + MIO_EMM_DMA_CFG(host)); |
---|
176 | 183 | |
---|
177 | 184 | clk_disable_unprepare(host->clk); |
---|
| 185 | + pci_release_regions(pdev); |
---|
178 | 186 | } |
---|
179 | 187 | |
---|
180 | 188 | static const struct pci_device_id thunder_mmc_id_table[] = { |
---|