summaryrefslogtreecommitdiffstats
path: root/drivers/media/i2c/ov5640.c
diff options
context:
space:
mode:
authorHugues Fruchet2018-02-06 14:24:09 +0100
committerMauro Carvalho Chehab2018-02-23 09:12:19 +0100
commit8670d70a4286fc9be47f4c9654e071bce97111f2 (patch)
treebc3b27dd76dd567eb0d11380f0e06d7ad7c5b9fc /drivers/media/i2c/ov5640.c
parentmedia: ov5640: various typo & style fixes (diff)
downloadkernel-qcow2-linux-8670d70a4286fc9be47f4c9654e071bce97111f2.tar.gz
kernel-qcow2-linux-8670d70a4286fc9be47f4c9654e071bce97111f2.tar.xz
kernel-qcow2-linux-8670d70a4286fc9be47f4c9654e071bce97111f2.zip
media: ov5640: fix virtual_channel parameter permissions
Fix module_param(virtual_channel) permissions. This problem was detected by checkpatch: $ scripts/checkpatch.pl -f drivers/media/i2c/ov5640.c ERROR: Use 4 digit octal (0777) not decimal permissions +module_param(virtual_channel, int, 0); Also add an error trace in case of virtual_channel not in the valid range of values. Signed-off-by: Hugues Fruchet <hugues.fruchet@st.com> Reviewed-by: Jacopo Mondi <jacopo+renesas@jmondi.org> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Diffstat (limited to 'drivers/media/i2c/ov5640.c')
-rw-r--r--drivers/media/i2c/ov5640.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/drivers/media/i2c/ov5640.c b/drivers/media/i2c/ov5640.c
index 696a28bde1b4..3e7b43ce2b7a 100644
--- a/drivers/media/i2c/ov5640.c
+++ b/drivers/media/i2c/ov5640.c
@@ -128,7 +128,7 @@ static const struct ov5640_pixfmt ov5640_formats[] = {
* to set the MIPI CSI-2 virtual channel.
*/
static unsigned int virtual_channel;
-module_param(virtual_channel, int, 0);
+module_param(virtual_channel, uint, 0444);
MODULE_PARM_DESC(virtual_channel,
"MIPI CSI-2 virtual channel (0..3), default 0");
@@ -1358,11 +1358,16 @@ static int ov5640_binning_on(struct ov5640_dev *sensor)
static int ov5640_set_virtual_channel(struct ov5640_dev *sensor)
{
+ struct i2c_client *client = sensor->i2c_client;
u8 temp, channel = virtual_channel;
int ret;
- if (channel > 3)
+ if (channel > 3) {
+ dev_err(&client->dev,
+ "%s: wrong virtual_channel parameter, expected (0..3), got %d\n",
+ __func__, channel);
return -EINVAL;
+ }
ret = ov5640_read_reg(sensor, OV5640_REG_DEBUG_MODE, &temp);
if (ret)