* [PATCH -next] [media] davinci: vpfe: fix return value check in vpfe_enable_clock()
@ 2013-03-11 13:57 Wei Yongjun
2013-03-12 4:42 ` Prabhakar Lad
2013-03-17 10:20 ` Sakari Ailus
0 siblings, 2 replies; 3+ messages in thread
From: Wei Yongjun @ 2013-03-11 13:57 UTC (permalink / raw)
To: mchehab, gregkh, prabhakar.lad, sakari.ailus, laurent.pinchart,
hans.verkuil
Cc: yongjun_wei, linux-media, devel
From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
In case of error, the function clk_get() returns ERR_PTR()
and never returns NULL. The NULL test in the return value
check should be replaced with IS_ERR().
Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
---
drivers/staging/media/davinci_vpfe/vpfe_mc_capture.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/staging/media/davinci_vpfe/vpfe_mc_capture.c b/drivers/staging/media/davinci_vpfe/vpfe_mc_capture.c
index 7b35171..6a8222c 100644
--- a/drivers/staging/media/davinci_vpfe/vpfe_mc_capture.c
+++ b/drivers/staging/media/davinci_vpfe/vpfe_mc_capture.c
@@ -243,7 +243,7 @@ static int vpfe_enable_clock(struct vpfe_device *vpfe_dev)
vpfe_dev->clks[i] =
clk_get(vpfe_dev->pdev, vpfe_cfg->clocks[i]);
- if (vpfe_dev->clks[i] == NULL) {
+ if (IS_ERR(vpfe_dev->clks[i])) {
v4l2_err(vpfe_dev->pdev->driver,
"Failed to get clock %s\n",
vpfe_cfg->clocks[i]);
@@ -264,7 +264,7 @@ static int vpfe_enable_clock(struct vpfe_device *vpfe_dev)
return 0;
out:
for (i = 0; i < vpfe_cfg->num_clocks; i++)
- if (vpfe_dev->clks[i]) {
+ if (!IS_ERR(vpfe_dev->clks[i])) {
clk_disable_unprepare(vpfe_dev->clks[i]);
clk_put(vpfe_dev->clks[i]);
}
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH -next] [media] davinci: vpfe: fix return value check in vpfe_enable_clock()
2013-03-11 13:57 [PATCH -next] [media] davinci: vpfe: fix return value check in vpfe_enable_clock() Wei Yongjun
@ 2013-03-12 4:42 ` Prabhakar Lad
2013-03-17 10:20 ` Sakari Ailus
1 sibling, 0 replies; 3+ messages in thread
From: Prabhakar Lad @ 2013-03-12 4:42 UTC (permalink / raw)
To: Wei Yongjun
Cc: mchehab, gregkh, sakari.ailus, laurent.pinchart, hans.verkuil,
yongjun_wei, linux-media, devel, dlos
Hi Wei,
Thanks for the patch! I'll queue it up for v3.10
On Mon, Mar 11, 2013 at 7:27 PM, Wei Yongjun <weiyj.lk@gmail.com> wrote:
> From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
>
> In case of error, the function clk_get() returns ERR_PTR()
> and never returns NULL. The NULL test in the return value
> check should be replaced with IS_ERR().
>
> Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Acked-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
Regards,
--Prabhakar Lad
> ---
> drivers/staging/media/davinci_vpfe/vpfe_mc_capture.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/staging/media/davinci_vpfe/vpfe_mc_capture.c b/drivers/staging/media/davinci_vpfe/vpfe_mc_capture.c
> index 7b35171..6a8222c 100644
> --- a/drivers/staging/media/davinci_vpfe/vpfe_mc_capture.c
> +++ b/drivers/staging/media/davinci_vpfe/vpfe_mc_capture.c
> @@ -243,7 +243,7 @@ static int vpfe_enable_clock(struct vpfe_device *vpfe_dev)
>
> vpfe_dev->clks[i] =
> clk_get(vpfe_dev->pdev, vpfe_cfg->clocks[i]);
> - if (vpfe_dev->clks[i] == NULL) {
> + if (IS_ERR(vpfe_dev->clks[i])) {
> v4l2_err(vpfe_dev->pdev->driver,
> "Failed to get clock %s\n",
> vpfe_cfg->clocks[i]);
> @@ -264,7 +264,7 @@ static int vpfe_enable_clock(struct vpfe_device *vpfe_dev)
> return 0;
> out:
> for (i = 0; i < vpfe_cfg->num_clocks; i++)
> - if (vpfe_dev->clks[i]) {
> + if (!IS_ERR(vpfe_dev->clks[i])) {
> clk_disable_unprepare(vpfe_dev->clks[i]);
> clk_put(vpfe_dev->clks[i]);
> }
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-media" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH -next] [media] davinci: vpfe: fix return value check in vpfe_enable_clock()
2013-03-11 13:57 [PATCH -next] [media] davinci: vpfe: fix return value check in vpfe_enable_clock() Wei Yongjun
2013-03-12 4:42 ` Prabhakar Lad
@ 2013-03-17 10:20 ` Sakari Ailus
1 sibling, 0 replies; 3+ messages in thread
From: Sakari Ailus @ 2013-03-17 10:20 UTC (permalink / raw)
To: Wei Yongjun, mchehab, gregkh, prabhakar.lad, laurent.pinchart,
hans.verkuil
Cc: yongjun_wei, linux-media, devel
Hi Wei,
Wei Yongjun wrote:
> From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
>
> In case of error, the function clk_get() returns ERR_PTR()
> and never returns NULL. The NULL test in the return value
> check should be replaced with IS_ERR().
>
> Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Reviewed-by: Sakari Ailus <sakari.ailus@iki.fi>
--
Kind regards,
Sakari Ailus
sakari.ailus@iki.fi
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-03-17 10:16 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-11 13:57 [PATCH -next] [media] davinci: vpfe: fix return value check in vpfe_enable_clock() Wei Yongjun
2013-03-12 4:42 ` Prabhakar Lad
2013-03-17 10:20 ` Sakari Ailus
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).