From: Peter Senna Tschudin <peter.senna@gmail.com>
To: Chas Williams <chas@cmf.nrl.navy.mil>
Cc: Peter Senna Tschudin <peter.senna@gmail.com>,
linux-atm-general@lists.sourceforge.net, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org,
davem@davemloft.net
Subject: [PATCH 3/4 V2] atm: idt77252: Remove redundant error check
Date: Mon, 19 May 2014 12:26:52 +0200 [thread overview]
Message-ID: <1400495212-9150-1-git-send-email-peter.senna@gmail.com> (raw)
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
next reply other threads:[~2014-05-19 10:26 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-19 10:26 Peter Senna Tschudin [this message]
2014-05-21 19:56 ` [PATCH 3/4 V2] atm: idt77252: Remove redundant error check David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1400495212-9150-1-git-send-email-peter.senna@gmail.com \
--to=peter.senna@gmail.com \
--cc=chas@cmf.nrl.navy.mil \
--cc=davem@davemloft.net \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-atm-general@lists.sourceforge.net \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).