Skip to content

Commit

Permalink
sata: ahci-da850: Fix some error handling paths in 'ahci_da850_probe()'
Browse files Browse the repository at this point in the history
'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>
  • Loading branch information
Christophe JAILLET authored and Tejun Heo committed Aug 16, 2017
1 parent 2f60e1a commit c88c094
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions drivers/ata/ahci_da850.c
Original file line number Diff line number Diff line change
Expand Up @@ -216,12 +216,16 @@ static int ahci_da850_probe(struct platform_device *pdev)
return rc;

res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
if (!res)
if (!res) {
rc = -ENODEV;
goto disable_resources;
}

pwrdn_reg = devm_ioremap(dev, res->start, resource_size(res));
if (!pwrdn_reg)
if (!pwrdn_reg) {
rc = -ENOMEM;
goto disable_resources;
}

da850_sata_init(dev, pwrdn_reg, hpriv->mmio, mpy);

Expand Down

0 comments on commit c88c094

Please sign in to comment.