aboutsummaryrefslogtreecommitdiffstats
path: root/sound/oss/dmasound
diff options
context:
space:
mode:
authorJesper Juhl <juhl-lkml@dif.dk>2005-06-25 17:58:49 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-06-25 19:25:00 -0400
commit09417379be9b126e10ae7dcd7afc20b666146266 (patch)
tree0236f4cb1afb4cf9a7f13b67e6ac639c55fa0440 /sound/oss/dmasound
parent4ae6673e029d609da7ef4311440d6de501d6967a (diff)
[PATCH] remove redundant NULL checks before kfree() in sound/ and avoid casting pointers about to be kfree()'ed
Checking a pointer for NULL before calling kfree() on it is redundant, kfree() deals with NULL pointers just fine. This patch removes such checks from sound/ This patch also makes another, but closely related, change. It avoids casting pointers about to be kfree()'ed. Signed-off-by: Jesper Juhl <juhl-lkml@dif.dk> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'sound/oss/dmasound')
-rw-r--r--sound/oss/dmasound/dmasound_awacs.c20
1 files changed, 7 insertions, 13 deletions
diff --git a/sound/oss/dmasound/dmasound_awacs.c b/sound/oss/dmasound/dmasound_awacs.c
index 5281b88987f3..33108661e671 100644
--- a/sound/oss/dmasound/dmasound_awacs.c
+++ b/sound/oss/dmasound/dmasound_awacs.c
@@ -671,14 +671,10 @@ static void PMacIrqCleanup(void)
671 release_OF_resource(awacs_node, 1); 671 release_OF_resource(awacs_node, 1);
672 release_OF_resource(awacs_node, 2); 672 release_OF_resource(awacs_node, 2);
673 673
674 if (awacs_tx_cmd_space) 674 kfree(awacs_tx_cmd_space);
675 kfree(awacs_tx_cmd_space); 675 kfree(awacs_rx_cmd_space);
676 if (awacs_rx_cmd_space) 676 kfree(beep_dbdma_cmd_space);
677 kfree(awacs_rx_cmd_space); 677 kfree(beep_buf);
678 if (beep_dbdma_cmd_space)
679 kfree(beep_dbdma_cmd_space);
680 if (beep_buf)
681 kfree(beep_buf);
682#ifdef CONFIG_PMAC_PBOOK 678#ifdef CONFIG_PMAC_PBOOK
683 pmu_unregister_sleep_notifier(&awacs_sleep_notifier); 679 pmu_unregister_sleep_notifier(&awacs_sleep_notifier);
684#endif 680#endif
@@ -2301,8 +2297,7 @@ if (count <= 0)
2301#endif 2297#endif
2302 2298
2303 if ((write_sq.max_count + 1) > number_of_tx_cmd_buffers) { 2299 if ((write_sq.max_count + 1) > number_of_tx_cmd_buffers) {
2304 if (awacs_tx_cmd_space) 2300 kfree(awacs_tx_cmd_space);
2305 kfree(awacs_tx_cmd_space);
2306 number_of_tx_cmd_buffers = 0; 2301 number_of_tx_cmd_buffers = 0;
2307 2302
2308 /* we need nbufs + 1 (for the loop) and we should request + 1 2303 /* we need nbufs + 1 (for the loop) and we should request + 1
@@ -2360,8 +2355,7 @@ if (count <= 0)
2360#endif 2355#endif
2361 2356
2362 if ((read_sq.max_count+1) > number_of_rx_cmd_buffers ) { 2357 if ((read_sq.max_count+1) > number_of_rx_cmd_buffers ) {
2363 if (awacs_rx_cmd_space) 2358 kfree(awacs_rx_cmd_space);
2364 kfree(awacs_rx_cmd_space);
2365 number_of_rx_cmd_buffers = 0; 2359 number_of_rx_cmd_buffers = 0;
2366 2360
2367 /* we need nbufs + 1 (for the loop) and we should request + 1 again 2361 /* we need nbufs + 1 (for the loop) and we should request + 1 again
@@ -2805,7 +2799,7 @@ __init setup_beep(void)
2805 beep_buf = (short *) kmalloc(BEEP_BUFLEN * 4, GFP_KERNEL); 2799 beep_buf = (short *) kmalloc(BEEP_BUFLEN * 4, GFP_KERNEL);
2806 if (beep_buf == NULL) { 2800 if (beep_buf == NULL) {
2807 printk(KERN_ERR "dmasound_pmac: no memory for beep buffer\n"); 2801 printk(KERN_ERR "dmasound_pmac: no memory for beep buffer\n");
2808 if( beep_dbdma_cmd_space ) kfree(beep_dbdma_cmd_space) ; 2802 kfree(beep_dbdma_cmd_space) ;
2809 return -ENOMEM ; 2803 return -ENOMEM ;
2810 } 2804 }
2811 return 0 ; 2805 return 0 ;