Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1734744
| From | Dan Carpenter <dan.carpenter@oracle.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH 5/6] [media] go7007: Use common error handling code in go7007_snd_init() |
| Date | 2017-09-19 10:50 +0200 |
| Message-ID | <urmoa-1TP-7@gated-at.bofh.it> (permalink) |
| References | <ur4KB-70P-9@gated-at.bofh.it> <ur4KB-70P-13@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
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
Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread
[PATCH 5/6] [media] go7007: Use common error handling code in go7007_snd_init() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-09-18 16:00 +0200 Re: [PATCH 5/6] [media] go7007: Use common error handling code in go7007_snd_init() Dan Carpenter <dan.carpenter@oracle.com> - 2017-09-19 10:50 +0200
csiph-web