[PATCH 1/1] media: ov5670: Fix probe on ACPI

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



devm_clk_get() will return either an error or NULL, which the driver
handles, continuing to use the clock of reading the value of the
clock-frequency property.

However, the value of ov5670->xvclk is left as-is and the other clock
framework functions aren't capable of handling error values.

Assign ov5670->xvclk to NULL if the clock cannot be found (apart from probe
deferral case).

Fixes: 8004c91e2095 ("media: i2c: ov5670: Use common clock framework")
Signed-off-by: Sakari Ailus <sakari.ailus@xxxxxxxxxxxxxxx>
---
 drivers/media/i2c/ov5670.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/media/i2c/ov5670.c b/drivers/media/i2c/ov5670.c
index f79d908f4531..50c73ad86e21 100644
--- a/drivers/media/i2c/ov5670.c
+++ b/drivers/media/i2c/ov5670.c
@@ -2661,14 +2661,16 @@ static int ov5670_probe(struct i2c_client *client)
 	}
 
 	ov5670->xvclk = devm_clk_get(&client->dev, NULL);
-	if (!IS_ERR_OR_NULL(ov5670->xvclk))
+	if (!IS_ERR_OR_NULL(ov5670->xvclk)) {
 		input_clk = clk_get_rate(ov5670->xvclk);
-	else if (PTR_ERR(ov5670->xvclk) == -ENOENT)
+	} else if (PTR_ERR(ov5670->xvclk) == -ENOENT) {
 		device_property_read_u32(&client->dev, "clock-frequency",
 					 &input_clk);
-	else
+		ov5670->xvclk = NULL;
+	} else {
 		return dev_err_probe(&client->dev, PTR_ERR(ov5670->xvclk),
 				     "error getting clock\n");
+	}
 
 	if (input_clk != OV5670_XVCLK_FREQ) {
 		dev_err(&client->dev,
-- 
2.30.2




[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux