summaryrefslogtreecommitdiff
path: root/drivers/media/i2c
diff options
context:
space:
mode:
authorSakari Ailus <sakari.ailus@linux.intel.com>2020-10-08 18:43:56 +0200
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>2021-01-12 17:52:31 +0100
commit2f23ecbf40c8c6572017a036505695e1c2ebb7c4 (patch)
treedf1519dbeb1093330a5682ff34c01e82275f0db2 /drivers/media/i2c
parent2fed6c84dc6fb9e374466d8a0ba86eb6ca7868f8 (diff)
media: ccs: Add a sanity check for external clock frequency
The driver depends on the external clock frequency. Add a sanity check for the frequency, by returning an error from probe if it's zero. Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Diffstat (limited to 'drivers/media/i2c')
-rw-r--r--drivers/media/i2c/ccs/ccs-core.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/media/i2c/ccs/ccs-core.c b/drivers/media/i2c/ccs/ccs-core.c
index fae8ceded861..08fce285f73a 100644
--- a/drivers/media/i2c/ccs/ccs-core.c
+++ b/drivers/media/i2c/ccs/ccs-core.c
@@ -3275,6 +3275,11 @@ static int ccs_probe(struct i2c_client *client)
return -EINVAL;
}
+ if (!sensor->hwcfg.ext_clk) {
+ dev_err(&client->dev, "cannot work with xclk frequency 0\n");
+ return -EINVAL;
+ }
+
sensor->reset = devm_gpiod_get_optional(&client->dev, "reset",
GPIOD_OUT_HIGH);
if (IS_ERR(sensor->reset))