Skip to contentSkip to conversation

ata: ahci_platform: fix devm_ioremap_resource() return value checking

PATCH Applied Bartlomiej Zolnierkiewicz 2 participants 2 messages Mar 14, 2014

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ata: ahci_platform: fix devm_ioremap_resource() return value checking

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.

---
Compile tested only.

 drivers/ata/ahci_platform.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/ata/ahci_platform.c +3 -3
Index: b/drivers/ata/ahci_platform.c
===================================================================
@@ -199,8 +199,7 @@ static void ahci_platform_put_resources(
  * 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
 
 	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;
 	}
 
Applied
#1 lore raw
Quoted 7 lines · Bartlomiej Zolnierkiewicz

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.

Applied to libata/for-3.15.

Thanks.

Signature · 1 line
tejun