From 47d92ab6aecefb28019e9f6c5458b325cadf2eac Mon Sep 17 00:00:00 2001 From: Rui Miguel Silva Date: Tue, 20 Feb 2018 23:48:12 +0000 Subject: media: ov2680: do not try to read control values if disable Control values can only be read if the sensor is power up, if not the i2c reading will fail. So, make sure that only in enable status control get be fetched. Signed-off-by: Rui Miguel Silva --- drivers/media/i2c/ov2680.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/media/i2c/ov2680.c b/drivers/media/i2c/ov2680.c index 5de332e5d87d..faaf8b10632f 100644 --- a/drivers/media/i2c/ov2680.c +++ b/drivers/media/i2c/ov2680.c @@ -831,6 +831,9 @@ static int ov2680_g_volatile_ctrl(struct v4l2_ctrl *ctrl) struct ov2680_dev *sensor = to_ov2680_dev(sd); int val; + if (!sensor->is_enabled) + return 0; + switch (ctrl->id) { case V4L2_CID_AUTOGAIN: if (!ctrl->val) -- cgit v1.2.3