media: smiapp: Only some selection targets are settable
authorSakari Ailus <sakari.ailus@iki.fi>
Thu, 6 Nov 2014 20:49:45 +0000 (17:49 -0300)
committerDanny Wood <danwood76@gmail.com>
Tue, 29 Jan 2019 13:05:23 +0000 (13:05 +0000)
commit b31eb901c4e5eeef4c83c43dfbc7fe0d4348cb21 upstream.

Setting a non-settable selection target caused BUG() to be called. The check
for valid selections only takes the selection target into account, but does
not tell whether it may be set, or only get. Fix the issue by simply
returning an error to the user.

Signed-off-by: Sakari Ailus <sakari.ailus@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/media/i2c/smiapp/smiapp-core.c

index cae4f46838517472f4f705267ed9b3e93a1999c1..b280216de31b6927a1a1e5d499cd6d8dbd17ad0c 100644 (file)
@@ -2139,7 +2139,7 @@ static int smiapp_set_selection(struct v4l2_subdev *subdev,
                ret = smiapp_set_compose(subdev, fh, sel);
                break;
        default:
-               BUG();
+               ret = -EINVAL;
        }
 
        mutex_unlock(&sensor->mutex);