aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata/sata_uli.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ata/sata_uli.c')
-rw-r--r--drivers/ata/sata_uli.c43
1 files changed, 13 insertions, 30 deletions
diff --git a/drivers/ata/sata_uli.c b/drivers/ata/sata_uli.c
index a43aec62d505..22eed6d07495 100644
--- a/drivers/ata/sata_uli.c
+++ b/drivers/ata/sata_uli.c
@@ -122,8 +122,6 @@ static const struct ata_port_operations uli_ops = {
122 .scr_write = uli_scr_write, 122 .scr_write = uli_scr_write,
123 123
124 .port_start = ata_port_start, 124 .port_start = ata_port_start,
125 .port_stop = ata_port_stop,
126 .host_stop = ata_host_stop,
127}; 125};
128 126
129static struct ata_port_info uli_port_info = { 127static struct ata_port_info uli_port_info = {
@@ -189,41 +187,36 @@ static int uli_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
189 struct ata_port_info *ppi[2]; 187 struct ata_port_info *ppi[2];
190 int rc; 188 int rc;
191 unsigned int board_idx = (unsigned int) ent->driver_data; 189 unsigned int board_idx = (unsigned int) ent->driver_data;
192 int pci_dev_busy = 0;
193 struct uli_priv *hpriv; 190 struct uli_priv *hpriv;
194 191
195 if (!printed_version++) 192 if (!printed_version++)
196 dev_printk(KERN_INFO, &pdev->dev, "version " DRV_VERSION "\n"); 193 dev_printk(KERN_INFO, &pdev->dev, "version " DRV_VERSION "\n");
197 194
198 rc = pci_enable_device(pdev); 195 rc = pcim_enable_device(pdev);
199 if (rc) 196 if (rc)
200 return rc; 197 return rc;
201 198
202 rc = pci_request_regions(pdev, DRV_NAME); 199 rc = pci_request_regions(pdev, DRV_NAME);
203 if (rc) { 200 if (rc) {
204 pci_dev_busy = 1; 201 pcim_pin_device(pdev);
205 goto err_out; 202 return rc;
206 } 203 }
207 204
208 rc = pci_set_dma_mask(pdev, ATA_DMA_MASK); 205 rc = pci_set_dma_mask(pdev, ATA_DMA_MASK);
209 if (rc) 206 if (rc)
210 goto err_out_regions; 207 return rc;
211 rc = pci_set_consistent_dma_mask(pdev, ATA_DMA_MASK); 208 rc = pci_set_consistent_dma_mask(pdev, ATA_DMA_MASK);
212 if (rc) 209 if (rc)
213 goto err_out_regions; 210 return rc;
214 211
215 ppi[0] = ppi[1] = &uli_port_info; 212 ppi[0] = ppi[1] = &uli_port_info;
216 probe_ent = ata_pci_init_native_mode(pdev, ppi, ATA_PORT_PRIMARY | ATA_PORT_SECONDARY); 213 probe_ent = ata_pci_init_native_mode(pdev, ppi, ATA_PORT_PRIMARY | ATA_PORT_SECONDARY);
217 if (!probe_ent) { 214 if (!probe_ent)
218 rc = -ENOMEM; 215 return -ENOMEM;
219 goto err_out_regions;
220 }
221 216
222 hpriv = kzalloc(sizeof(*hpriv), GFP_KERNEL); 217 hpriv = devm_kzalloc(&pdev->dev, sizeof(*hpriv), GFP_KERNEL);
223 if (!hpriv) { 218 if (!hpriv)
224 rc = -ENOMEM; 219 return -ENOMEM;
225 goto err_out_probe_ent;
226 }
227 220
228 probe_ent->private_data = hpriv; 221 probe_ent->private_data = hpriv;
229 222
@@ -269,21 +262,11 @@ static int uli_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
269 pci_set_master(pdev); 262 pci_set_master(pdev);
270 pci_intx(pdev, 1); 263 pci_intx(pdev, 1);
271 264
272 /* FIXME: check ata_device_add return value */ 265 if (!ata_device_add(probe_ent))
273 ata_device_add(probe_ent); 266 return -ENODEV;
274 kfree(probe_ent);
275 267
268 devm_kfree(&pdev->dev, probe_ent);
276 return 0; 269 return 0;
277
278err_out_probe_ent:
279 kfree(probe_ent);
280err_out_regions:
281 pci_release_regions(pdev);
282err_out:
283 if (!pci_dev_busy)
284 pci_disable_device(pdev);
285 return rc;
286
287} 270}
288 271
289static int __init uli_init(void) 272static int __init uli_init(void)