diff options
author | Christophe JAILLET <christophe.jaillet@wanadoo.fr> | 2017-08-16 01:31:03 -0400 |
---|---|---|
committer | Tejun Heo <tj@kernel.org> | 2017-08-16 10:38:27 -0400 |
commit | c88c094985ad38c6f71ab5b0d3d68757db14c8b2 (patch) | |
tree | 6990101a2c0585c17e7b2bc76d59973dd99445a6 | |
parent | 2f60e1ab2f0e148e82cb53c539ad003ffc9b9bd0 (diff) |
sata: ahci-da850: Fix some error handling paths in 'ahci_da850_probe()'
'rc' is known to be 0 at this point.
If 'platform_get_resource()' or 'devm_ioremap()' fail, return -ENOMEM
instead of 0 which means success.
tj: Changed error code from -ENOMEM to -ENODEV for get_resource
failure as suggested by Sergei.
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
-rw-r--r-- | drivers/ata/ahci_da850.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/ata/ahci_da850.c b/drivers/ata/ahci_da850.c index 1a50cd3b4233..9b34dff64536 100644 --- a/drivers/ata/ahci_da850.c +++ b/drivers/ata/ahci_da850.c | |||
@@ -216,12 +216,16 @@ static int ahci_da850_probe(struct platform_device *pdev) | |||
216 | return rc; | 216 | return rc; |
217 | 217 | ||
218 | res = platform_get_resource(pdev, IORESOURCE_MEM, 1); | 218 | res = platform_get_resource(pdev, IORESOURCE_MEM, 1); |
219 | if (!res) | 219 | if (!res) { |
220 | rc = -ENODEV; | ||
220 | goto disable_resources; | 221 | goto disable_resources; |
222 | } | ||
221 | 223 | ||
222 | pwrdn_reg = devm_ioremap(dev, res->start, resource_size(res)); | 224 | pwrdn_reg = devm_ioremap(dev, res->start, resource_size(res)); |
223 | if (!pwrdn_reg) | 225 | if (!pwrdn_reg) { |
226 | rc = -ENOMEM; | ||
224 | goto disable_resources; | 227 | goto disable_resources; |
228 | } | ||
225 | 229 | ||
226 | da850_sata_init(dev, pwrdn_reg, hpriv->mmio, mpy); | 230 | da850_sata_init(dev, pwrdn_reg, hpriv->mmio, mpy); |
227 | 231 | ||