summaryrefslogtreecommitdiff
path: root/drivers/media/i2c
diff options
context:
space:
mode:
authorJacopo Mondi <jacopo@jmondi.org>2022-11-04 17:24:48 +0300
committerMauro Carvalho Chehab <mchehab@kernel.org>2022-11-25 11:44:24 +0300
commit6e27ef31a5c17068dc032289f3cc132ceedce2f8 (patch)
tree565524921104be0c5b281457ccb2a0ba007e5af7 /drivers/media/i2c
parent3a51fd71b6f59610abad0e88315c20fd3e5b4b79 (diff)
downloadlinux-6e27ef31a5c17068dc032289f3cc132ceedce2f8.tar.xz
media: ar0521: Refuse unsupported controls
Refuse unsupported controls by returning -EINVAL in the s_ctrl operation. While at it, remove a the default switch case in the first switch as it effectively is now a no-op. Signed-off-by: Jacopo Mondi <jacopo@jmondi.org> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Diffstat (limited to 'drivers/media/i2c')
-rw-r--r--drivers/media/i2c/ar0521.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/media/i2c/ar0521.c b/drivers/media/i2c/ar0521.c
index d30f7a1c7651..acb9509d7708 100644
--- a/drivers/media/i2c/ar0521.c
+++ b/drivers/media/i2c/ar0521.c
@@ -514,9 +514,6 @@ static int ar0521_s_ctrl(struct v4l2_ctrl *ctrl)
sensor->total_height = sensor->fmt.width +
sensor->ctrls.vblank->val;
break;
- default:
- ret = -EINVAL;
- break;
}
/* access the sensor only if it's powered up */
@@ -546,6 +543,11 @@ static int ar0521_s_ctrl(struct v4l2_ctrl *ctrl)
ret = ar0521_write_reg(sensor, AR0521_REG_TEST_PATTERN_MODE,
ctrl->val);
break;
+ default:
+ dev_err(&sensor->i2c_client->dev,
+ "Unsupported control %x\n", ctrl->id);
+ ret = -EINVAL;
+ break;
}
pm_runtime_put(&sensor->i2c_client->dev);