[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <s5hd4xz1ngm.wl%tiwai@suse.de>
Date: Tue, 07 Aug 2007 15:30:33 +0200
From: Takashi Iwai <tiwai@...e.de>
To: Eugene Teo <eugeneteo@...nel.sg>
Cc: linux-kernel@...r.kernel.org
Subject: Re: [ALSA] seq: resource leak fix and various code cleanups
At Tue, 7 Aug 2007 18:52:49 +0800,
Eugene Teo wrote:
>
> diff --git a/sound/core/seq/oss/seq_oss_init.c b/sound/core/seq/oss/seq_oss_init.c
> index ca5a2ed..f26b751 100644
> --- a/sound/core/seq/oss/seq_oss_init.c
> +++ b/sound/core/seq/oss/seq_oss_init.c
> @@ -176,29 +176,31 @@ snd_seq_oss_open(struct file *file, int level)
> int i, rc;
> struct seq_oss_devinfo *dp;
>
> - if ((dp = kzalloc(sizeof(*dp), GFP_KERNEL)) == NULL) {
> + dp = kzalloc(sizeof(*dp), GFP_KERNEL);
> + if (!dp) {
> snd_printk(KERN_ERR "can't malloc device info\n");
> return -ENOMEM;
> }
> debug_printk(("oss_open: dp = %p\n", dp));
>
> + dp->cseq = system_client;
> + dp->port = -1;
> + dp->queue = -1;
> + dp->readq = NULL;
> + dp->writeq = NULL;
NULL initialization is redundant, as it's kzalloced.
> @@ -235,7 +239,8 @@ snd_seq_oss_open(struct file *file, int level)
> /* initialize read queue */
> debug_printk(("initialize read queue\n"));
> if (is_read_mode(dp->file_mode)) {
> - if ((dp->readq = snd_seq_oss_readq_new(dp, maxqlen)) == NULL) {
> + dp->readq = snd_seq_oss_readq_new(dp, maxqlen);
> + if (dp->readq == NULL) {
"if (!dp->readq)" is preferred.
> @@ -253,7 +258,8 @@ snd_seq_oss_open(struct file *file, int level)
>
> /* initialize timer */
> debug_printk(("initialize timer\n"));
> - if ((dp->timer = snd_seq_oss_timer_new(dp)) == NULL) {
> + dp->timer = snd_seq_oss_timer_new(dp);
> + if (dp->timer == NULL) {
Ditto.
I fixed these and applied your patch to ALSA tree now.
Thanks!
Takashi
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists