From: Julia Lawall <julia@diku.dk>
To: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: [PATCH 2/12] drivers/char: Correct redundant test
Date: Mon, 27 Jul 2009 18:12:53 +0200 (CEST) [thread overview]
Message-ID: <Pine.LNX.4.64.0907271812340.2682@ask.diku.dk> (raw)
From: Julia Lawall <julia@diku.dk>
dc was tested for NULL at the beginning of the function, in which case the
function returns. dc does not seem to be updated in the meantime, so the
second test is unnecessary. I have assumed that the comment, "notify
card" goes with the code below it.
A simplified version of the semantic match that finds this problem is as
follows: (http://www.emn.fr/x-info/coccinelle/)
// <smpl>
@r exists@
local idexpression x;
expression E;
@@
if (x@ == NULL || ...) { ... when forall
return ...; }
... when != \(x=E\|x--\|x++\|--x\|++x\|x-=E\|x+=E\|x|=E\|x&=E\|&x\)
(
*x == NULL
|
*x != NULL
)
// </smpl>
Signed-off-by: Julia Lawall <julia@diku.dk>
---
drivers/char/nozomi.c | 7 +------
1 files changed, 1 insertions(+), 6 deletions(-)
diff --git a/drivers/char/nozomi.c b/drivers/char/nozomi.c
index ec58d8c..9322fec 100644
--- a/drivers/char/nozomi.c
+++ b/drivers/char/nozomi.c
@@ -1675,11 +1675,6 @@ static int ntty_write(struct tty_struct *tty, const unsigned char *buffer,
rval = __kfifo_put(port->fifo_ul, (unsigned char *)buffer, count);
/* notify card */
- if (unlikely(dc == NULL)) {
- DBG1("No device context?");
- goto exit;
- }
-
spin_lock_irqsave(&dc->spin_mutex, flags);
/* CTS is only valid on the modem channel */
if (port == &(dc->port[PORT_MDM])) {
reply other threads:[~2009-07-27 16:16 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=Pine.LNX.4.64.0907271812340.2682@ask.diku.dk \
--to=julia@diku.dk \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@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
all inboxes | Powered by JetHome®