From: Jesper Juhl <juhl-lkml@dif.dk>
To: linux-kernel@vger.kernel.org
Cc: Ed Okerson <eokerson@quicknet.net>, akpm@osdl.org
Subject: [PATCH] kfree cleanups (remove redundant NULL checks) in drivers/telephony/ (actually ixj.c only)
Date: Sat, 7 May 2005 02:58:14 +0200 (CEST) [thread overview]
Message-ID: <Pine.LNX.4.62.0505070254180.2384@dragon.hyggekrogen.localhost> (raw)
This patch removes redundant checks for NULL pointer before kfree() in
drivers/telephony/
Signed-off-by: Jesper Juhl <juhl-lkml@dif.dk>
---
drivers/telephony/ixj.c | 48 +++++++++++++++++-------------------------------
1 files changed, 17 insertions(+), 31 deletions(-)
diff -upr linux-2.6.12-rc3-mm3-orig/drivers/telephony/ixj.c linux-2.6.12-rc3-mm3/drivers/telephony/ixj.c
--- linux-2.6.12-rc3-mm3-orig/drivers/telephony/ixj.c 2005-05-06 23:21:17.000000000 +0200
+++ linux-2.6.12-rc3-mm3/drivers/telephony/ixj.c 2005-05-07 02:53:15.000000000 +0200
@@ -329,10 +329,8 @@ static IXJ *ixj_alloc()
static void ixj_fsk_free(IXJ *j)
{
- if(j->fskdata != NULL) {
- kfree(j->fskdata);
- j->fskdata = NULL;
- }
+ kfree(j->fskdata);
+ j->fskdata = NULL;
}
static void ixj_fsk_alloc(IXJ *j)
@@ -3869,11 +3867,9 @@ static int set_rec_codec(IXJ *j, int rat
default:
j->rec_frame_size = 0;
j->rec_mode = -1;
- if (j->read_buffer) {
- kfree(j->read_buffer);
- j->read_buffer = NULL;
- j->read_buffer_size = 0;
- }
+ kfree(j->read_buffer);
+ j->read_buffer = NULL;
+ j->read_buffer_size = 0;
retval = 1;
break;
}
@@ -3994,11 +3990,9 @@ static void ixj_record_stop(IXJ *j)
if(ixjdebug & 0x0002)
printk("IXJ %d Stopping Record Codec %d at %ld\n", j->board, j->rec_codec, jiffies);
- if (j->read_buffer) {
- kfree(j->read_buffer);
- j->read_buffer = NULL;
- j->read_buffer_size = 0;
- }
+ kfree(j->read_buffer);
+ j->read_buffer = NULL;
+ j->read_buffer_size = 0;
if (j->rec_mode > -1) {
ixj_WriteDSPCommand(0x5120, j);
j->rec_mode = -1;
@@ -4451,11 +4445,9 @@ static int set_play_codec(IXJ *j, int ra
default:
j->play_frame_size = 0;
j->play_mode = -1;
- if (j->write_buffer) {
- kfree(j->write_buffer);
- j->write_buffer = NULL;
- j->write_buffer_size = 0;
- }
+ kfree(j->write_buffer);
+ j->write_buffer = NULL;
+ j->write_buffer_size = 0;
retval = 1;
break;
}
@@ -4581,11 +4573,9 @@ static void ixj_play_stop(IXJ *j)
if(ixjdebug & 0x0002)
printk("IXJ %d Stopping Play Codec %d at %ld\n", j->board, j->play_codec, jiffies);
- if (j->write_buffer) {
- kfree(j->write_buffer);
- j->write_buffer = NULL;
- j->write_buffer_size = 0;
- }
+ kfree(j->write_buffer);
+ j->write_buffer = NULL;
+ j->write_buffer_size = 0;
if (j->play_mode > -1) {
ixj_WriteDSPCommand(0x5221, j); /* Stop playback and flush buffers. 8022 reference page 9-40 */
@@ -5810,9 +5800,7 @@ static void ixj_cpt_stop(IXJ *j)
ixj_play_tone(j, 0);
j->tone_state = j->tone_cadence_state = 0;
if (j->cadence_t) {
- if (j->cadence_t->ce) {
- kfree(j->cadence_t->ce);
- }
+ kfree(j->cadence_t->ce);
kfree(j->cadence_t);
j->cadence_t = NULL;
}
@@ -7497,10 +7485,8 @@ static void cleanup(void)
printk(KERN_INFO "IXJ: Releasing XILINX address for /dev/phone%d\n", cnt);
release_region(j->XILINXbase, 4);
}
- if (j->read_buffer)
- kfree(j->read_buffer);
- if (j->write_buffer)
- kfree(j->write_buffer);
+ kfree(j->read_buffer);
+ kfree(j->write_buffer);
if (j->dev)
pnp_device_detach(j->dev);
if (ixjdebug & 0x0002)
next reply other threads:[~2005-05-07 0:55 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-05-07 0:58 Jesper Juhl [this message]
2005-05-07 1:54 ` Jesper Juhl
2005-05-07 2:02 ` Andrew Morton
2005-05-07 2:09 ` Jesper Juhl
2005-05-08 22:03 ` Jesper Juhl
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.62.0505070254180.2384@dragon.hyggekrogen.localhost \
--to=juhl-lkml@dif.dk \
--cc=akpm@osdl.org \
--cc=eokerson@quicknet.net \
--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®