Skip to contentSkip to conversation

atm: idt77252: Remove redundant error check

PATCH Superseded Peter Senna Tschudin 2 participants 2 messages May 17, 2014 – May 19, 2014

Subsystems (4)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 3/4 atm: idt77252: Remove redundant error check

Remove double checks, and move the call to printk to the first check. Also adds KERN_WARNING to printk. The simplified version of the coccinelle semantic patch that fixes 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.

---
 drivers/atm/idt77252.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/atm/idt77252.c +4 -4
index 1bdf104..a8b6402 100644
@@ -2551,12 +2551,12 @@ done:
 		timeout = 5 * 1000;
 		while (atomic_read(&vc->scq->used) > 0) {
 			timeout = msleep_interruptible(timeout);
-			if (!timeout)
+			if (!timeout) {
+				printk(KERN_WARNING "%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);
maintainer
#1 lore raw

From: Peter Senna Tschudin <[email protected]>
Date: Sat, 17 May 2014 20:22:59 +0200

Quoted 3 lines

Remove double checks, and move the call to printk to the first check. Also adds KERN_WARNING to printk. The simplified version of the coccinelle semantic patch that fixes this issue is as follows:

The appropriate thing to use is pr_warning() rather than add KERN_WARNING.