aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/telephony
diff options
context:
space:
mode:
authorJesper Juhl <juhl-lkml@dif.dk>2005-06-25 17:59:14 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-06-25 19:25:06 -0400
commit0159f76d9f5839c3c92bc3a91c865e94d5e489a8 (patch)
tree84ea61ef0b48fd7f8f089d234c3395366fc93672 /drivers/telephony
parent89e0b1134e46195c64bbad21010799ba567bf7f2 (diff)
[PATCH] kfree cleanups in ixj.c
This patch removes redundant checks for NULL pointer before kfree() in drivers/telephony/ 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 'drivers/telephony')
-rw-r--r--drivers/telephony/ixj.c52
1 files changed, 19 insertions, 33 deletions
diff --git a/drivers/telephony/ixj.c b/drivers/telephony/ixj.c
index d5863b8b56ee..f2c9fa423d40 100644
--- a/drivers/telephony/ixj.c
+++ b/drivers/telephony/ixj.c
@@ -329,10 +329,8 @@ static IXJ *ixj_alloc()
329 329
330static void ixj_fsk_free(IXJ *j) 330static void ixj_fsk_free(IXJ *j)
331{ 331{
332 if(j->fskdata != NULL) { 332 kfree(j->fskdata);
333 kfree(j->fskdata); 333 j->fskdata = NULL;
334 j->fskdata = NULL;
335 }
336} 334}
337 335
338static void ixj_fsk_alloc(IXJ *j) 336static void ixj_fsk_alloc(IXJ *j)
@@ -3867,13 +3865,11 @@ static int set_rec_codec(IXJ *j, int rate)
3867 j->rec_mode = 7; 3865 j->rec_mode = 7;
3868 break; 3866 break;
3869 default: 3867 default:
3868 kfree(j->read_buffer);
3870 j->rec_frame_size = 0; 3869 j->rec_frame_size = 0;
3871 j->rec_mode = -1; 3870 j->rec_mode = -1;
3872 if (j->read_buffer) { 3871 j->read_buffer = NULL;
3873 kfree(j->read_buffer); 3872 j->read_buffer_size = 0;
3874 j->read_buffer = NULL;
3875 j->read_buffer_size = 0;
3876 }
3877 retval = 1; 3873 retval = 1;
3878 break; 3874 break;
3879 } 3875 }
@@ -3991,14 +3987,12 @@ static int ixj_record_start(IXJ *j)
3991 3987
3992static void ixj_record_stop(IXJ *j) 3988static void ixj_record_stop(IXJ *j)
3993{ 3989{
3994 if(ixjdebug & 0x0002) 3990 if (ixjdebug & 0x0002)
3995 printk("IXJ %d Stopping Record Codec %d at %ld\n", j->board, j->rec_codec, jiffies); 3991 printk("IXJ %d Stopping Record Codec %d at %ld\n", j->board, j->rec_codec, jiffies);
3996 3992
3997 if (j->read_buffer) { 3993 kfree(j->read_buffer);
3998 kfree(j->read_buffer); 3994 j->read_buffer = NULL;
3999 j->read_buffer = NULL; 3995 j->read_buffer_size = 0;
4000 j->read_buffer_size = 0;
4001 }
4002 if (j->rec_mode > -1) { 3996 if (j->rec_mode > -1) {
4003 ixj_WriteDSPCommand(0x5120, j); 3997 ixj_WriteDSPCommand(0x5120, j);
4004 j->rec_mode = -1; 3998 j->rec_mode = -1;
@@ -4449,13 +4443,11 @@ static int set_play_codec(IXJ *j, int rate)
4449 j->play_mode = 5; 4443 j->play_mode = 5;
4450 break; 4444 break;
4451 default: 4445 default:
4446 kfree(j->write_buffer);
4452 j->play_frame_size = 0; 4447 j->play_frame_size = 0;
4453 j->play_mode = -1; 4448 j->play_mode = -1;
4454 if (j->write_buffer) { 4449 j->write_buffer = NULL;
4455 kfree(j->write_buffer); 4450 j->write_buffer_size = 0;
4456 j->write_buffer = NULL;
4457 j->write_buffer_size = 0;
4458 }
4459 retval = 1; 4451 retval = 1;
4460 break; 4452 break;
4461 } 4453 }
@@ -4578,14 +4570,12 @@ static int ixj_play_start(IXJ *j)
4578 4570
4579static void ixj_play_stop(IXJ *j) 4571static void ixj_play_stop(IXJ *j)
4580{ 4572{
4581 if(ixjdebug & 0x0002) 4573 if (ixjdebug & 0x0002)
4582 printk("IXJ %d Stopping Play Codec %d at %ld\n", j->board, j->play_codec, jiffies); 4574 printk("IXJ %d Stopping Play Codec %d at %ld\n", j->board, j->play_codec, jiffies);
4583 4575
4584 if (j->write_buffer) { 4576 kfree(j->write_buffer);
4585 kfree(j->write_buffer); 4577 j->write_buffer = NULL;
4586 j->write_buffer = NULL; 4578 j->write_buffer_size = 0;
4587 j->write_buffer_size = 0;
4588 }
4589 if (j->play_mode > -1) { 4579 if (j->play_mode > -1) {
4590 ixj_WriteDSPCommand(0x5221, j); /* Stop playback and flush buffers. 8022 reference page 9-40 */ 4580 ixj_WriteDSPCommand(0x5221, j); /* Stop playback and flush buffers. 8022 reference page 9-40 */
4591 4581
@@ -5810,9 +5800,7 @@ static void ixj_cpt_stop(IXJ *j)
5810 ixj_play_tone(j, 0); 5800 ixj_play_tone(j, 0);
5811 j->tone_state = j->tone_cadence_state = 0; 5801 j->tone_state = j->tone_cadence_state = 0;
5812 if (j->cadence_t) { 5802 if (j->cadence_t) {
5813 if (j->cadence_t->ce) { 5803 kfree(j->cadence_t->ce);
5814 kfree(j->cadence_t->ce);
5815 }
5816 kfree(j->cadence_t); 5804 kfree(j->cadence_t);
5817 j->cadence_t = NULL; 5805 j->cadence_t = NULL;
5818 } 5806 }
@@ -7497,10 +7485,8 @@ static void cleanup(void)
7497 printk(KERN_INFO "IXJ: Releasing XILINX address for /dev/phone%d\n", cnt); 7485 printk(KERN_INFO "IXJ: Releasing XILINX address for /dev/phone%d\n", cnt);
7498 release_region(j->XILINXbase, 4); 7486 release_region(j->XILINXbase, 4);
7499 } 7487 }
7500 if (j->read_buffer) 7488 kfree(j->read_buffer);
7501 kfree(j->read_buffer); 7489 kfree(j->write_buffer);
7502 if (j->write_buffer)
7503 kfree(j->write_buffer);
7504 if (j->dev) 7490 if (j->dev)
7505 pnp_device_detach(j->dev); 7491 pnp_device_detach(j->dev);
7506 if (ixjdebug & 0x0002) 7492 if (ixjdebug & 0x0002)