All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 3/4 V2] atm: idt77252: Remove redundant error check
@ 2014-05-19 10:26 ` Peter Senna Tschudin
  0 siblings, 0 replies; 4+ messages in thread
From: Peter Senna Tschudin @ 2014-05-19 10:26 UTC (permalink / raw)
  To: Chas Williams
  Cc: Peter Senna Tschudin, linux-atm-general, netdev, linux-kernel,
	kernel-janitors, davem

Remove double checks, convert printk to pr_warn, and move the call to
pr_warn to the first check. The simplified version of the coccinelle
semantic patch that find this issue is as follows:

// <smpl>
@@
expression E; identifier pr; expression list es;
@@
while(...){
...
-       if (E) break;
+       if (E){
+               pr(es);
+               break;
+       }
...
}
- if(E) pr(es);
// </smpl>

Tested by compilation only.

Signed-off-by: Peter Senna Tschudin <peter.senna@gmail.com>
---
Changes from V1:
 - Convert printk(KERN_WARNING ... to pr_warn(...

 drivers/atm/idt77252.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/atm/idt77252.c b/drivers/atm/idt77252.c
index 1bdf104..b621f56 100644
--- a/drivers/atm/idt77252.c
+++ b/drivers/atm/idt77252.c
@@ -2551,12 +2551,12 @@ done:
 		timeout = 5 * 1000;
 		while (atomic_read(&vc->scq->used) > 0) {
 			timeout = msleep_interruptible(timeout);
-			if (!timeout)
+			if (!timeout) {
+				pr_warn("%s: SCQ drain timeout: %u used\n",
+					card->name, atomic_read(&vc->scq->used));
 				break;
+			}
 		}
-		if (!timeout)
-			printk("%s: SCQ drain timeout: %u used\n",
-			       card->name, atomic_read(&vc->scq->used));
 
 		writel(TCMDQ_HALT | vc->index, SAR_REG_TCMDQ);
 		clear_scd(card, vc->scq, vc->class);
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 3/4 V2] atm: idt77252: Remove redundant error check
@ 2014-05-19 10:26 ` Peter Senna Tschudin
  0 siblings, 0 replies; 4+ messages in thread
From: Peter Senna Tschudin @ 2014-05-19 10:26 UTC (permalink / raw)
  To: Chas Williams
  Cc: Peter Senna Tschudin, linux-atm-general, netdev, linux-kernel,
	kernel-janitors, davem

Remove double checks, convert printk to pr_warn, and move the call to
pr_warn to the first check. The simplified version of the coccinelle
semantic patch that find this issue is as follows:

// <smpl>
@@
expression E; identifier pr; expression list es;
@@
while(...){
...
-       if (E) break;
+       if (E){
+               pr(es);
+               break;
+       }
...
}
- if(E) pr(es);
// </smpl>

Tested by compilation only.

Signed-off-by: Peter Senna Tschudin <peter.senna@gmail.com>
---
Changes from V1:
 - Convert printk(KERN_WARNING ... to pr_warn(...

 drivers/atm/idt77252.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/atm/idt77252.c b/drivers/atm/idt77252.c
index 1bdf104..b621f56 100644
--- a/drivers/atm/idt77252.c
+++ b/drivers/atm/idt77252.c
@@ -2551,12 +2551,12 @@ done:
 		timeout = 5 * 1000;
 		while (atomic_read(&vc->scq->used) > 0) {
 			timeout = msleep_interruptible(timeout);
-			if (!timeout)
+			if (!timeout) {
+				pr_warn("%s: SCQ drain timeout: %u used\n",
+					card->name, atomic_read(&vc->scq->used));
 				break;
+			}
 		}
-		if (!timeout)
-			printk("%s: SCQ drain timeout: %u used\n",
-			       card->name, atomic_read(&vc->scq->used));
 
 		writel(TCMDQ_HALT | vc->index, SAR_REG_TCMDQ);
 		clear_scd(card, vc->scq, vc->class);
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 3/4 V2] atm: idt77252: Remove redundant error check
  2014-05-19 10:26 ` Peter Senna Tschudin
@ 2014-05-21 19:56   ` David Miller
  -1 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2014-05-21 19:56 UTC (permalink / raw)
  To: peter.senna
  Cc: chas, linux-atm-general, netdev, linux-kernel, kernel-janitors

From: Peter Senna Tschudin <peter.senna@gmail.com>
Date: Mon, 19 May 2014 12:26:52 +0200

> Remove double checks, convert printk to pr_warn, and move the call to
> pr_warn to the first check. The simplified version of the coccinelle
> semantic patch that find this issue is as follows:
 ...
> Tested by compilation only.
> 
> Signed-off-by: Peter Senna Tschudin <peter.senna@gmail.com>

Applied to net-next, thanks.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 3/4 V2] atm: idt77252: Remove redundant error check
@ 2014-05-21 19:56   ` David Miller
  0 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2014-05-21 19:56 UTC (permalink / raw)
  To: peter.senna
  Cc: chas, linux-atm-general, netdev, linux-kernel, kernel-janitors

From: Peter Senna Tschudin <peter.senna@gmail.com>
Date: Mon, 19 May 2014 12:26:52 +0200

> Remove double checks, convert printk to pr_warn, and move the call to
> pr_warn to the first check. The simplified version of the coccinelle
> semantic patch that find this issue is as follows:
 ...
> Tested by compilation only.
> 
> Signed-off-by: Peter Senna Tschudin <peter.senna@gmail.com>

Applied to net-next, thanks.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-05-21 19:56 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-05-19 10:26 [PATCH 3/4 V2] atm: idt77252: Remove redundant error check Peter Senna Tschudin
2014-05-19 10:26 ` Peter Senna Tschudin
2014-05-21 19:56 ` David Miller
2014-05-21 19:56   ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.