009891c40f472121884d7d789821234357da6520
[oweals/openwrt.git] /
1 From 4beea0c16ceaefc78e2fb6b5a2a0548bd6d04ee6 Mon Sep 17 00:00:00 2001
2 From: Dave Stevenson <dave.stevenson@raspberrypi.org>
3 Date: Thu, 10 May 2018 12:42:14 -0700
4 Subject: [PATCH 374/454] staging: bcm2835-camera: Replace BUG_ON with return
5  error
6
7 commit 84db34cd720964adf0c9019d6d1b4de1cb26d1de upstream.
8
9 The error conditions don't warrant taking the kernel down, so remove
10 BUG_ON.
11
12 Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
13 Signed-off-by: Eric Anholt <eric@anholt.net>
14 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
15 ---
16  .../staging/vc04_services/bcm2835-camera/bcm2835-camera.c  | 7 ++++---
17  1 file changed, 4 insertions(+), 3 deletions(-)
18
19 --- a/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c
20 +++ b/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c
21 @@ -304,8 +304,8 @@ static int buffer_prepare(struct vb2_buf
22         v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, "%s: dev:%p, vb %p\n",
23                  __func__, dev, vb);
24  
25 -       BUG_ON(!dev->capture.port);
26 -       BUG_ON(!dev->capture.fmt);
27 +       if (!dev->capture.port || !dev->capture.fmt)
28 +               return -ENODEV;
29  
30         size = dev->capture.stride * dev->capture.height;
31         if (vb2_plane_size(vb, 0) < size) {
32 @@ -1050,7 +1050,8 @@ static int mmal_setup_components(struct
33         struct mmal_fmt *mfmt = get_format(f);
34         u32 remove_padding;
35  
36 -       BUG_ON(!mfmt);
37 +       if (!mfmt)
38 +               return -EINVAL;
39  
40         if (dev->capture.encode_component) {
41                 v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev,