From: Christophe JAILLET Date: Wed, 16 Aug 2017 05:31:03 +0000 (+0200) Subject: sata: ahci-da850: Fix some error handling paths in 'ahci_da850_probe()' X-Git-Tag: v4.14-rc1~209^2~3 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c88c094985ad38c6f71ab5b0d3d68757db14c8b2;p=platform%2Fkernel%2Flinux-rpi.git 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 Signed-off-by: Tejun Heo Cc: Sergei Shtylyov --- diff --git a/drivers/ata/ahci_da850.c b/drivers/ata/ahci_da850.c index 1a50cd3..9b34dff 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) 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);