mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-07 19:30:30 +09:00
staging: bcm2835-camera: Abort probe if there is no camera
[ Upstream commit7566f39dfd] Abort the probing of the camera driver in case there isn't a camera actually connected to the Raspberry Pi. This solution also avoids a NULL ptr dereference of mmal instance on driver unload. Fixes:7b3ad5abf0("staging: Import the BCM2835 MMAL-based V4L2 camera driver.") Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com> Reviewed-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de> Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
bd8e3189b8
commit
13a6b2276a
@@ -1854,6 +1854,12 @@ static int bcm2835_mmal_probe(struct platform_device *pdev)
|
||||
num_cameras = get_num_cameras(instance,
|
||||
resolutions,
|
||||
MAX_BCM2835_CAMERAS);
|
||||
|
||||
if (num_cameras < 1) {
|
||||
ret = -ENODEV;
|
||||
goto cleanup_mmal;
|
||||
}
|
||||
|
||||
if (num_cameras > MAX_BCM2835_CAMERAS)
|
||||
num_cameras = MAX_BCM2835_CAMERAS;
|
||||
|
||||
@@ -1953,6 +1959,9 @@ cleanup_gdev:
|
||||
pr_info("%s: error %d while loading driver\n",
|
||||
BM2835_MMAL_MODULE_NAME, ret);
|
||||
|
||||
cleanup_mmal:
|
||||
vchiq_mmal_finalise(instance);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user