Re: [PATCH] sound: Remove redundant steps

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 10 Mar 2021 07:34:26 +0100,
zuoqilin1@xxxxxxx wrote:
> 
> From: zuoqilin <zuoqilin@xxxxxxxxxx>
> 
> 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@xxxxxxxxxx>
> ---
>  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
> 
> 



[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Pulse Audio]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux