staging: bcm2835-camera: fix error handling in init
authorDan Carpenter <dan.carpenter@oracle.com>
Fri, 17 Feb 2017 23:20:15 +0000 (02:20 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 6 Mar 2017 08:17:02 +0000 (09:17 +0100)
commit8e17858a8818b40d66e83de2bf3724c64eaad72d
tree52110d34a141bfbca8e5724c3fd0b4b28f8bfedf
parent0743a78fde7cc561ad53b657be693e7f9981a73a
staging: bcm2835-camera: fix error handling in init

The unwinding here isn't right.  We don't free gdev[0] and instead
free 1 step past what was allocated.  Also we can't allocate "dev" then
we should unwind instead of returning directly.

Fixes: 7b3ad5abf027 ("staging: Import the BCM2835 MMAL-based V4L2 camera driver.")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: walter harms <wharms@bfs.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/media/platform/bcm2835/bcm2835-camera.c