diff options
Diffstat (limited to 'drivers/ata')
-rw-r--r-- | drivers/ata/ahci_platform.c | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/drivers/ata/ahci_platform.c b/drivers/ata/ahci_platform.c index 5e11b160f247..68ef6b563b7d 100644 --- a/drivers/ata/ahci_platform.c +++ b/drivers/ata/ahci_platform.c | |||
@@ -54,19 +54,13 @@ static int __init ahci_probe(struct platform_device *pdev) | |||
54 | return -EINVAL; | 54 | return -EINVAL; |
55 | } | 55 | } |
56 | 56 | ||
57 | if (pdata && pdata->init) { | ||
58 | rc = pdata->init(dev); | ||
59 | if (rc) | ||
60 | return rc; | ||
61 | } | ||
62 | |||
63 | if (pdata && pdata->ata_port_info) | 57 | if (pdata && pdata->ata_port_info) |
64 | pi = *pdata->ata_port_info; | 58 | pi = *pdata->ata_port_info; |
65 | 59 | ||
66 | hpriv = devm_kzalloc(dev, sizeof(*hpriv), GFP_KERNEL); | 60 | hpriv = devm_kzalloc(dev, sizeof(*hpriv), GFP_KERNEL); |
67 | if (!hpriv) { | 61 | if (!hpriv) { |
68 | rc = -ENOMEM; | 62 | dev_err(dev, "can't alloc ahci_host_priv\n"); |
69 | goto err0; | 63 | return -ENOMEM; |
70 | } | 64 | } |
71 | 65 | ||
72 | hpriv->flags |= (unsigned long)pi.private_data; | 66 | hpriv->flags |= (unsigned long)pi.private_data; |
@@ -74,8 +68,19 @@ static int __init ahci_probe(struct platform_device *pdev) | |||
74 | hpriv->mmio = devm_ioremap(dev, mem->start, resource_size(mem)); | 68 | hpriv->mmio = devm_ioremap(dev, mem->start, resource_size(mem)); |
75 | if (!hpriv->mmio) { | 69 | if (!hpriv->mmio) { |
76 | dev_err(dev, "can't map %pR\n", mem); | 70 | dev_err(dev, "can't map %pR\n", mem); |
77 | rc = -ENOMEM; | 71 | return -ENOMEM; |
78 | goto err0; | 72 | } |
73 | |||
74 | /* | ||
75 | * Some platforms might need to prepare for mmio region access, | ||
76 | * which could be done in the following init call. So, the mmio | ||
77 | * region shouldn't be accessed before init (if provided) has | ||
78 | * returned successfully. | ||
79 | */ | ||
80 | if (pdata && pdata->init) { | ||
81 | rc = pdata->init(dev, hpriv->mmio); | ||
82 | if (rc) | ||
83 | return rc; | ||
79 | } | 84 | } |
80 | 85 | ||
81 | ahci_save_initial_config(dev, hpriv, | 86 | ahci_save_initial_config(dev, hpriv, |