ata: ahci_platform: fix devm_ioremap_resource() return value checking
authorBartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Fri, 14 Mar 2014 17:22:09 +0000 (18:22 +0100)
committerTejun Heo <tj@kernel.org>
Fri, 14 Mar 2014 18:30:28 +0000 (14:30 -0400)
devm_ioremap_resource() returns a pointer to the remapped memory or
an ERR_PTR() encoded error code on failure.  Fix the check inside
ahci_platform_get_resources() accordingly.

Also while at it remove a needless line break.

Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
drivers/ata/ahci_platform.c

index db24d2a080512b5ec96ce85b7f6de30b1ecbad10..70fbf664a73cd9d3f74f864fbf38df489abbe195 100644 (file)
@@ -199,8 +199,7 @@ static void ahci_platform_put_resources(struct device *dev, void *res)
  * RETURNS:
  * The allocated ahci_host_priv on success, otherwise an ERR_PTR value
  */
-struct ahci_host_priv *ahci_platform_get_resources(
-       struct platform_device *pdev)
+struct ahci_host_priv *ahci_platform_get_resources(struct platform_device *pdev)
 {
        struct device *dev = &pdev->dev;
        struct ahci_host_priv *hpriv;
@@ -219,8 +218,9 @@ struct ahci_host_priv *ahci_platform_get_resources(
 
        hpriv->mmio = devm_ioremap_resource(dev,
                              platform_get_resource(pdev, IORESOURCE_MEM, 0));
-       if (!hpriv->mmio) {
+       if (IS_ERR(hpriv->mmio)) {
                dev_err(dev, "no mmio space\n");
+               rc = PTR_ERR(hpriv->mmio);
                goto err_out;
        }