Skip to contentSkip to conversation

pata_arasan_cf: fix ata_host_activate() failure handling

PATCH In review Bartlomiej Zolnierkiewicz 2 participants 3 messages Mar 31, 2014 – Apr 14, 2014

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

PATCH 1/1 pata_arasan_cf: fix ata_host_activate() failure handling

Add missing cf_exit() and clk_put() calls to ata_host_activate() failure path.

---
 drivers/ata/pata_arasan_cf.c |   10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/ata/pata_arasan_cf.c +8 -2
Index: b/drivers/ata/pata_arasan_cf.c
===================================================================
@@ -898,9 +898,15 @@ static int arasan_cf_probe(struct platfo
 
 	cf_card_detect(acdev, 0);
 
-	return ata_host_activate(host, acdev->irq, irq_handler, 0,
-			&arasan_cf_sht);
+	ret = ata_host_activate(host, acdev->irq, irq_handler, 0,
+				&arasan_cf_sht);
+	if (ret)
+		goto exit_cf;
 
+	return 0;
+
+exit_cf:
+	cf_exit(acdev);
 free_clk:
 	clk_put(acdev->clk);
 	return ret;
#1 lore raw
Quoted 16 lines · Bartlomiej Zolnierkiewicz

Add missing cf_exit() and clk_put() calls to ata_host_activate() failure path.

---
 drivers/ata/pata_arasan_cf.c |   10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

Index: b/drivers/ata/pata_arasan_cf.c
===================================================================

drivers/ata/pata_arasan_cf.c 2014-03-31 17:09:48.171715498 +0200 renamed from drivers/ata/pata_arasan_cf.c 2014-03-31 16:57:47.443727785 +0200 +0 -0
@@ -898,9 +898,15 @@ static int arasan_cf_probe(struct platfo
 

drivers/ata/pata_arasan_cf.c 2014-03-31 17:09:48.171715498 +0200 static int arasan_cf_probe(struct platfo · line 906

Quoted 10 lines
drivers/ata/pata_arasan_cf.c 2014-03-31 17:09:48.171715498 +0200 renamed from drivers/ata/pata_arasan_cf.c 2014-03-31 16:57:47.443727785 +0200 +5 -2
        cf_card_detect(acdev, 0);
 
-       return ata_host_activate(host, acdev->irq, irq_handler, 0,
-                       &arasan_cf_sht);
+       ret = ata_host_activate(host, acdev->irq, irq_handler, 0,
+                               &arasan_cf_sht);
+       if (ret)
+               goto exit_cf;
 
+       return 0;

Probably this would be better:

if (!ret)
return 0

and then no need of a goto..

Quoted 7 lines
drivers/ata/pata_arasan_cf.c 2014-03-31 17:09:48.171715498 +0200 renamed from drivers/ata/pata_arasan_cf.c 2014-03-31 16:57:47.443727785 +0200 +3 -0
+
+exit_cf:
+       cf_exit(acdev);
 free_clk:
        clk_put(acdev->clk);
        return ret;
#2 lore raw

Hi,

Quoted 27 lines · Viresh Kumar
Quoted 25 lines · Bartlomiej Zolnierkiewicz

Add missing cf_exit() and clk_put() calls to ata_host_activate() failure path.

---
 drivers/ata/pata_arasan_cf.c |   10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

Index: b/drivers/ata/pata_arasan_cf.c
===================================================================

drivers/ata/pata_arasan_cf.c 2014-03-31 17:09:48.171715498 +0200 renamed from drivers/ata/pata_arasan_cf.c 2014-03-31 16:57:47.443727785 +0200 +4 -2
@@ -898,9 +898,15 @@ static int arasan_cf_probe(struct platfo
 
        cf_card_detect(acdev, 0);
 
-       return ata_host_activate(host, acdev->irq, irq_handler, 0,
-                       &arasan_cf_sht);
+       ret = ata_host_activate(host, acdev->irq, irq_handler, 0,
+                               &arasan_cf_sht);
+       if (ret)
+               goto exit_cf;
 
Quoted 8 lines

drivers/ata/pata_arasan_cf.c 2014-03-31 17:09:48.171715498 +0200 static int arasan_cf_probe(struct platfo · line 906

Quoted 1 line
drivers/ata/pata_arasan_cf.c 2014-03-31 17:09:48.171715498 +0200 renamed from drivers/ata/pata_arasan_cf.c 2014-03-31 16:57:47.443727785 +0200 +1 -0
+       return 0;

Probably this would be better:

if (!ret)
return 0

and then no need of a goto..

I considered doing it this way initially but decided that code consistency with other host drivers is more important. However if this is what you prefer I'll re-do the patch and post it as v2.

Quoted 7 lines

drivers/ata/pata_arasan_cf.c 2014-03-31 17:09:48.171715498 +0200 static int arasan_cf_probe(struct platfo · line 912

Quoted 7 lines
drivers/ata/pata_arasan_cf.c 2014-03-31 17:09:48.171715498 +0200 renamed from drivers/ata/pata_arasan_cf.c 2014-03-31 16:57:47.443727785 +0200 +3 -0
+
+exit_cf:
+       cf_exit(acdev);
 free_clk:
        clk_put(acdev->clk);
        return ret;

Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics