Skip to content

Commit

Permalink
atm: idt77252: Remove redundant error check
Browse files Browse the repository at this point in the history
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>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Peter Senna Tschudin authored and David S. Miller committed May 21, 2014
1 parent 1495664 commit 7e91035
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions drivers/atm/idt77252.c
Original file line number Diff line number Diff line change
Expand Up @@ -2551,12 +2551,12 @@ idt77252_close(struct atm_vcc *vcc)
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);
Expand Down

0 comments on commit 7e91035

Please sign in to comment.