All of lore.kernel.org
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: zuoqilin1@163.com
Cc: alsa-devel@alsa-project.org, lars@metafoo.de, tiwai@suse.com,
	broonie@kernel.org, joe@perches.com,
	zuoqilin <zuoqilin@yulong.com>
Subject: Re: [PATCH] sound: Remove redundant steps
Date: Wed, 10 Mar 2021 10:09:04 +0100	[thread overview]
Message-ID: <s5hzgzbxtn3.wl-tiwai@suse.de> (raw)
In-Reply-To: <20210310063426.524-1-zuoqilin1@163.com>

On Wed, 10 Mar 2021 07:34:26 +0100,
zuoqilin1@163.com wrote:
> 
> From: zuoqilin <zuoqilin@yulong.com>
> 
> If kzalloc fail,not need free it,so just return
> -ENOMEM when kzalloc fail.

No, this check is performed after two kzalloc calls, so one might
remain if you return immediately there.


thanks,

Takashi

> 
> Signed-off-by: zuoqilin <zuoqilin@yulong.com>
> ---
>  sound/core/oss/mixer_oss.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/sound/core/oss/mixer_oss.c b/sound/core/oss/mixer_oss.c
> index bec9283..eec61dc 100644
> --- a/sound/core/oss/mixer_oss.c
> +++ b/sound/core/oss/mixer_oss.c
> @@ -800,8 +800,7 @@ static int snd_mixer_oss_get_recsrc2(struct snd_mixer_oss_file *fmixer, unsigned
>  	uinfo = kzalloc(sizeof(*uinfo), GFP_KERNEL);
>  	uctl = kzalloc(sizeof(*uctl), GFP_KERNEL);
>  	if (uinfo == NULL || uctl == NULL) {
> -		err = -ENOMEM;
> -		goto __free_only;
> +		return -ENOMEM;
>  	}
>  	down_read(&card->controls_rwsem);
>  	kctl = snd_mixer_oss_test_id(mixer, "Capture Source", 0);
> @@ -851,8 +850,7 @@ static int snd_mixer_oss_put_recsrc2(struct snd_mixer_oss_file *fmixer, unsigned
>  	uinfo = kzalloc(sizeof(*uinfo), GFP_KERNEL);
>  	uctl = kzalloc(sizeof(*uctl), GFP_KERNEL);
>  	if (uinfo == NULL || uctl == NULL) {
> -		err = -ENOMEM;
> -		goto __free_only;
> +		return -ENOMEM;
>  	}
>  	down_read(&card->controls_rwsem);
>  	kctl = snd_mixer_oss_test_id(mixer, "Capture Source", 0);
> -- 
> 1.9.1
> 
> 

  reply	other threads:[~2021-03-10  9:10 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-10  6:34 [PATCH] sound: Remove redundant steps zuoqilin1
2021-03-10  9:09 ` Takashi Iwai [this message]
2021-03-10 13:19 ` kernel test robot
2021-03-10 13:19   ` kernel test robot
2021-03-10 18:33 ` [kbuild] " Dan Carpenter
2021-03-10 18:33   ` Dan Carpenter
2021-03-10 18:33   ` Dan Carpenter
  -- strict thread matches above, loose matches on Subject: below --
2021-03-10 18:10 kernel test robot

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=s5hzgzbxtn3.wl-tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=joe@perches.com \
    --cc=lars@metafoo.de \
    --cc=tiwai@suse.com \
    --cc=zuoqilin1@163.com \
    --cc=zuoqilin@yulong.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.