From: Julien Brunel <brunel@diku.dk>
To: tiwai@suse.de, liam.girdwood@wolfsonmicro.com,
broonie@opensource.wolfsonmicro.com,
linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: [PATCH] sound/soc/at32: Useless NULL test
Date: Fri, 26 Sep 2008 15:23:46 +0200 [thread overview]
Message-ID: <200809261523.46747.brunel@diku.dk> (raw)
The test (ssc != NULL) can only be reached if the call to the function
ssc_request, the result of which ssc is assigned, succeeds. Moreover,
two statements assign NULL to ssc just before a return, which is useless
since it is a local variable. So, we suggest to delete the test and
the two assignments.
A simplified version of the semantic match that finds this problem is
as follows:
(http://www.emn.fr/x-info/coccinelle/)
// <smpl>
@bad_null_test@
expression x,E;
@@
x = ssc_request(...)
... when != x = E
* x != NULL
// </smpl>
Signed-off-by: Julien Brunel <brunel@diku.dk>
Signed-off-by: Julia Lawall <julia@diku.dk>
---
sound/soc/at32/playpaq_wm8510.c | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff -u -p a/sound/soc/at32/playpaq_wm8510.c b/sound/soc/at32/playpaq_wm8510.c
--- a/sound/soc/at32/playpaq_wm8510.c
+++ b/sound/soc/at32/playpaq_wm8510.c
@@ -405,7 +405,6 @@ static int __init playpaq_asoc_init(void
ssc = ssc_request(0);
if (IS_ERR(ssc)) {
ret = PTR_ERR(ssc);
- ssc = NULL;
goto err_ssc;
}
ssc_p->ssc = ssc;
@@ -476,10 +475,7 @@ err_pll0:
_gclk0 = NULL;
}
err_gclk0:
- if (ssc != NULL) {
- ssc_free(ssc);
- ssc = NULL;
- }
+ ssc_free(ssc);
err_ssc:
return ret;
}
next reply other threads:[~2008-09-26 13:24 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-09-26 13:23 Julien Brunel [this message]
2008-09-26 14:00 ` Mark Brown
2008-09-26 14:45 ` Takashi Iwai
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=200809261523.46747.brunel@diku.dk \
--to=brunel@diku.dk \
--cc=broonie@opensource.wolfsonmicro.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=liam.girdwood@wolfsonmicro.com \
--cc=linux-kernel@vger.kernel.org \
--cc=tiwai@suse.de \
/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®