diff options
author | Julien Brunel <brunel@diku.dk> | 2008-09-26 09:23:46 -0400 |
---|---|---|
committer | Jaroslav Kysela <perex@perex.cz> | 2008-10-10 07:41:40 -0400 |
commit | 71dc525c5d480397ac7343a0a2808f8a23705d42 (patch) | |
tree | 10395716d38a5a742d7071b4efc8f18819e9e464 /sound | |
parent | 9a9e2359f484402c620f9a3748037fea65fa5af4 (diff) |
ALSA: sound/soc/at32: Useless NULL test
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>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Diffstat (limited to 'sound')
-rw-r--r-- | sound/soc/at32/playpaq_wm8510.c | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/sound/soc/at32/playpaq_wm8510.c b/sound/soc/at32/playpaq_wm8510.c index 7e6560ba7510..98a2d5826a85 100644 --- a/sound/soc/at32/playpaq_wm8510.c +++ b/sound/soc/at32/playpaq_wm8510.c | |||
@@ -406,7 +406,6 @@ static int __init playpaq_asoc_init(void) | |||
406 | ssc = ssc_request(0); | 406 | ssc = ssc_request(0); |
407 | if (IS_ERR(ssc)) { | 407 | if (IS_ERR(ssc)) { |
408 | ret = PTR_ERR(ssc); | 408 | ret = PTR_ERR(ssc); |
409 | ssc = NULL; | ||
410 | goto err_ssc; | 409 | goto err_ssc; |
411 | } | 410 | } |
412 | ssc_p->ssc = ssc; | 411 | ssc_p->ssc = ssc; |
@@ -477,10 +476,7 @@ err_pll0: | |||
477 | _gclk0 = NULL; | 476 | _gclk0 = NULL; |
478 | } | 477 | } |
479 | err_gclk0: | 478 | err_gclk0: |
480 | if (ssc != NULL) { | 479 | ssc_free(ssc); |
481 | ssc_free(ssc); | ||
482 | ssc = NULL; | ||
483 | } | ||
484 | err_ssc: | 480 | err_ssc: |
485 | return ret; | 481 | return ret; |
486 | } | 482 | } |