ov7670: Return the real error code
PATCH 1/2 ov7670: Return the real error code
From: Fabio Estevam <[email protected]>
When devm_clk_get() fails the real error code should be propagated, instead of always returning -EPROBE_DEFER.
--- drivers/media/i2c/ov7670.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/i2c/ov7670.c +1 -1
@@ -1614,7 +1614,7 @@ static int ov7670_probe(struct i2c_client *client, info->clk =devm_clk_get (&client->dev,"xclk" );if (IS_ERR (info->clk)) -return -EPROBE_DEFER ; +return PTR_ERR (info->clk);clk_prepare_enable (info->clk); ret =ov7670_init_gpio (client, info);
Signature · 1 line
2.7.4
PATCH 2/2 ov7670: Check the return value from clk_prepare_enable()
From: Fabio Estevam <[email protected]>
clk_prepare_enable() may fail, so we should better check its return value and propagate it in the case of error.
--- drivers/media/i2c/ov7670.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/media/i2c/ov7670.c +3 -1
@@ -1615,7 +1615,9 @@ static int ov7670_probe(struct i2c_client *client, info->clk =devm_clk_get (&client->dev,"xclk" );if (IS_ERR (info->clk))return PTR_ERR (info->clk); -clk_prepare_enable (info->clk); + ret =clk_prepare_enable (info->clk); +if (ret) +return ret; ret =ov7670_init_gpio (client, info);if (ret)
Signature · 1 line
2.7.4
Quoted 6 lines · Fabio Estevam
From: Fabio Estevam <[email protected]>
When
devm_clk_get()fails the real error code should be propagated, instead of always returning -EPROBE_DEFER.Signed-off-by Fabio Estevam <[email protected]>
Hi Fabio,
I don't think -EPROBE_DEFER is returned by clk_get() if the clock can't be found. The clock providers often are e.g. ISP drivers that may well be loaded after the sensor driver. In that case this change would prevent successful initialisation of the drivers.
Quoted 20 lines
--- drivers/media/i2c/ov7670.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/media/i2c/ov7670.c +1
-1@@ -1614,7 +1614,7 @@ static int ov7670_probe(struct i2c_client *client, info->clk =devm_clk_get (&client->dev,"xclk" );if (IS_ERR (info->clk)) -return -EPROBE_DEFER ; +return PTR_ERR (info->clk);clk_prepare_enable (info->clk); ret =ov7670_init_gpio (client, info);Signature · 1 line
2.7.4
Signature · 2 lines
Sakari Ailus e-mail: [email protected] XMPP: [email protected]
Hi Sakari,
Quoted 2 lines · Sakari Ailus
I don't think -EPROBE_DEFER is returned by
clk_get()if the clock can't be found. The clock providers often are e.g. ISP drivers that may well be
Yes, it is.
Please check:
commit a34cd4666f3da84228a82f70c94b8d9b692034ea
Author: Jean-Francois Moine <[email protected]> Date: Mon Nov 25 19:47:04 2013 +0100
clk: return probe defer when DT clock not yet ready
At probe time, a clock device may not be ready when some other device wants to use it.
This patch lets the functions clk_get/devm_clk_get return a probe defer when the clock is defined in the DT but not yet available.
Quoted 15 lines · Fabio Estevam
Hi Sakari,
Quoted 2 lines · Sakari Ailus
I don't think -EPROBE_DEFER is returned by
clk_get()if the clock can't be found. The clock providers often are e.g. ISP drivers that may well beYes, it is.
Please check:
commit
a34cd4666f3da84228a82f70c94b8d9b692034eaAuthor: Jean-Francois Moine <[email protected]> Date: Mon Nov 25 19:47:04 2013 +0100
Quoted 7 lines
clk: return probe defer when DT clock not yet ready
At probe time, a clock device may not be ready when some other device wants to use it.
This patch lets the functions clk_get/devm_clk_get return a probe defer when the clock is defined in the DT but not yet available.
Nice! I'll apply both then.
Thanks!
Signature · 2 lines
Sakari Ailus e-mail: [email protected] XMPP: [email protected]