diff options
author | Julia Lawall <Julia.Lawall@lip6.fr> | 2012-04-22 06:54:42 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2012-05-02 08:09:10 -0400 |
commit | d63b21bfa8afbce0872fdb7718d822c5fd0878ea (patch) | |
tree | 1593b156b13cab9147e7eccdb6481864139a05bd /drivers/media/video/au0828/au0828-video.c | |
parent | bcb2cf6e0bf033d79821c89e5ccb328bfbd44907 (diff) |
[media] drivers/media/video/au0828/au0828-video.c: add missing video_device_release
At the point of the call to video_register_device, both dev->vbi_dev and
dev->vdev have been allocated, and so should be freed on failure. The
error-handling code is moved to the end of the function, to avoid code
duplication.
Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/au0828/au0828-video.c')
-rw-r--r-- | drivers/media/video/au0828/au0828-video.c | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/drivers/media/video/au0828/au0828-video.c b/drivers/media/video/au0828/au0828-video.c index 0b3e481ffe8c..141f9c23a5ca 100644 --- a/drivers/media/video/au0828/au0828-video.c +++ b/drivers/media/video/au0828/au0828-video.c | |||
@@ -1881,7 +1881,7 @@ int au0828_analog_register(struct au0828_dev *dev, | |||
1881 | int retval = -ENOMEM; | 1881 | int retval = -ENOMEM; |
1882 | struct usb_host_interface *iface_desc; | 1882 | struct usb_host_interface *iface_desc; |
1883 | struct usb_endpoint_descriptor *endpoint; | 1883 | struct usb_endpoint_descriptor *endpoint; |
1884 | int i; | 1884 | int i, ret; |
1885 | 1885 | ||
1886 | dprintk(1, "au0828_analog_register called!\n"); | 1886 | dprintk(1, "au0828_analog_register called!\n"); |
1887 | 1887 | ||
@@ -1951,8 +1951,8 @@ int au0828_analog_register(struct au0828_dev *dev, | |||
1951 | dev->vbi_dev = video_device_alloc(); | 1951 | dev->vbi_dev = video_device_alloc(); |
1952 | if (NULL == dev->vbi_dev) { | 1952 | if (NULL == dev->vbi_dev) { |
1953 | dprintk(1, "Can't allocate vbi_device.\n"); | 1953 | dprintk(1, "Can't allocate vbi_device.\n"); |
1954 | kfree(dev->vdev); | 1954 | ret = -ENOMEM; |
1955 | return -ENOMEM; | 1955 | goto err_vdev; |
1956 | } | 1956 | } |
1957 | 1957 | ||
1958 | /* Fill the video capture device struct */ | 1958 | /* Fill the video capture device struct */ |
@@ -1971,8 +1971,8 @@ int au0828_analog_register(struct au0828_dev *dev, | |||
1971 | if (retval != 0) { | 1971 | if (retval != 0) { |
1972 | dprintk(1, "unable to register video device (error = %d).\n", | 1972 | dprintk(1, "unable to register video device (error = %d).\n", |
1973 | retval); | 1973 | retval); |
1974 | video_device_release(dev->vdev); | 1974 | ret = -ENODEV; |
1975 | return -ENODEV; | 1975 | goto err_vbi_dev; |
1976 | } | 1976 | } |
1977 | 1977 | ||
1978 | /* Register the vbi device */ | 1978 | /* Register the vbi device */ |
@@ -1981,13 +1981,18 @@ int au0828_analog_register(struct au0828_dev *dev, | |||
1981 | if (retval != 0) { | 1981 | if (retval != 0) { |
1982 | dprintk(1, "unable to register vbi device (error = %d).\n", | 1982 | dprintk(1, "unable to register vbi device (error = %d).\n", |
1983 | retval); | 1983 | retval); |
1984 | video_device_release(dev->vbi_dev); | 1984 | ret = -ENODEV; |
1985 | video_device_release(dev->vdev); | 1985 | goto err_vbi_dev; |
1986 | return -ENODEV; | ||
1987 | } | 1986 | } |
1988 | 1987 | ||
1989 | dprintk(1, "%s completed!\n", __func__); | 1988 | dprintk(1, "%s completed!\n", __func__); |
1990 | 1989 | ||
1991 | return 0; | 1990 | return 0; |
1991 | |||
1992 | err_vbi_dev: | ||
1993 | video_device_release(dev->vbi_dev); | ||
1994 | err_vdev: | ||
1995 | video_device_release(dev->vdev); | ||
1996 | return ret; | ||
1992 | } | 1997 | } |
1993 | 1998 | ||