public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: SF Markus Elfring <elfring@users.sourceforge.net>
Cc: linux-media@vger.kernel.org,
	Hans Verkuil <hans.verkuil@cisco.com>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	LKML <linux-kernel@vger.kernel.org>,
	kernel-janitors@vger.kernel.org
Subject: Re: [PATCH 5/6] [media] go7007: Use common error handling code in go7007_snd_init()
Date: Tue, 19 Sep 2017 08:49:11 +0000	[thread overview]
Message-ID: <20170919084911.zknru7vuhafljuxb@mwanda> (raw)
In-Reply-To: <05efac78-3a14-803c-5b4a-68670728628b@users.sourceforge.net>

On Mon, Sep 18, 2017 at 03:58:37PM +0200, SF Markus Elfring wrote:
> diff --git a/drivers/media/usb/go7007/snd-go7007.c b/drivers/media/usb/go7007/snd-go7007.c
> index 68e421bf38e1..7ae4d03ed3f7 100644
> --- a/drivers/media/usb/go7007/snd-go7007.c
> +++ b/drivers/media/usb/go7007/snd-go7007.c
> @@ -243,22 +243,18 @@ int go7007_snd_init(struct go7007 *go)
>  	gosnd->capturing = 0;
>  	ret = snd_card_new(go->dev, index[dev], id[dev], THIS_MODULE, 0,
>  			   &gosnd->card);
> -	if (ret < 0) {
> -		kfree(gosnd);
> -		return ret;
> -	}
> +	if (ret < 0)
> +		goto free_snd;
> +
>  	ret = snd_device_new(gosnd->card, SNDRV_DEV_LOWLEVEL, go,
>  			&go7007_snd_device_ops);
> -	if (ret < 0) {
> -		kfree(gosnd);
> -		return ret;
> -	}
> +	if (ret < 0)
> +		goto free_snd;
> +


I think the original code is buggy.  It should probably call
snd_card_free() if snd_device_new() fails.

regards,
dan carpenter


  reply	other threads:[~2017-09-19  8:49 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-18 13:52 [PATCH 0/6] [media] Go7007: Adjustments for some function implementations SF Markus Elfring
2017-09-18 13:53 ` [PATCH 1/6] [media] go7007: Delete an error message for a failed memory allocation in go7007_load_en SF Markus Elfring
2017-09-18 13:55 ` [PATCH 2/6] [media] go7007: Adjust 35 checks for null pointers SF Markus Elfring
2017-09-18 13:56 ` [PATCH 3/6] [media] go7007: Improve a size determination in four functions SF Markus Elfring
2017-09-18 13:57 ` [PATCH 4/6] [media] go7007: Use common error handling code in s2250_probe() SF Markus Elfring
2017-09-19  8:42   ` Dan Carpenter
2017-09-20  7:09     ` SF Markus Elfring
2017-09-20  9:12       ` Dan Carpenter
2017-09-18 13:58 ` [PATCH 5/6] [media] go7007: Use common error handling code in go7007_snd_init() SF Markus Elfring
2017-09-19  8:49   ` Dan Carpenter [this message]
2017-09-18 14:00 ` [PATCH 6/6] [media] go7007: Delete an unnecessary variable initialisation " SF Markus Elfring

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=20170919084911.zknru7vuhafljuxb@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=elfring@users.sourceforge.net \
    --cc=hans.verkuil@cisco.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@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