* [PATCH 1/2] [media] coda: Check the return value from clk_prepare_enable()
@ 2013-07-20 18:48 Fabio Estevam
2013-07-20 18:48 ` [PATCH 2/2] [media] coda: No need to check the return value of platform_get_resource() Fabio Estevam
0 siblings, 1 reply; 3+ messages in thread
From: Fabio Estevam @ 2013-07-20 18:48 UTC (permalink / raw)
To: k.debski; +Cc: m.chehab, kernel, linux-media, Fabio Estevam
From: Fabio Estevam <fabio.estevam@freescale.com>
clk_prepare_enable() may fail, so let's check its return value and propagate it
in the case of error.
Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
---
drivers/media/platform/coda.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/drivers/media/platform/coda.c b/drivers/media/platform/coda.c
index df4ada88..dd76228 100644
--- a/drivers/media/platform/coda.c
+++ b/drivers/media/platform/coda.c
@@ -1559,14 +1559,20 @@ static int coda_open(struct file *file)
list_add(&ctx->list, &dev->instances);
coda_unlock(ctx);
- clk_prepare_enable(dev->clk_per);
- clk_prepare_enable(dev->clk_ahb);
+ ret = clk_prepare_enable(dev->clk_per);
+ if (ret)
+ goto err;
+
+ ret = clk_prepare_enable(dev->clk_ahb);
+ goto err_clk_ahb;
v4l2_dbg(1, coda_debug, &dev->v4l2_dev, "Created instance %d (%p)\n",
ctx->idx, ctx);
return 0;
+err_clk_ahb:
+ clk_disable_unprepare(dev->clk_per);
err:
v4l2_fh_del(&ctx->fh);
v4l2_fh_exit(&ctx->fh);
--
1.8.1.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH 2/2] [media] coda: No need to check the return value of platform_get_resource()
2013-07-20 18:48 [PATCH 1/2] [media] coda: Check the return value from clk_prepare_enable() Fabio Estevam
@ 2013-07-20 18:48 ` Fabio Estevam
2013-07-22 8:10 ` Philipp Zabel
0 siblings, 1 reply; 3+ messages in thread
From: Fabio Estevam @ 2013-07-20 18:48 UTC (permalink / raw)
To: k.debski; +Cc: m.chehab, kernel, linux-media, Fabio Estevam
From: Fabio Estevam <fabio.estevam@freescale.com>
When using devm_ioremap_resource(), we do not need to check the return value of
platform_get_resource(), so just remove it.
Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
---
drivers/media/platform/coda.c | 5 -----
1 file changed, 5 deletions(-)
diff --git a/drivers/media/platform/coda.c b/drivers/media/platform/coda.c
index dd76228..236385f 100644
--- a/drivers/media/platform/coda.c
+++ b/drivers/media/platform/coda.c
@@ -2038,11 +2038,6 @@ static int coda_probe(struct platform_device *pdev)
/* Get memory for physical registers */
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- if (res == NULL) {
- dev_err(&pdev->dev, "failed to get memory region resource\n");
- return -ENOENT;
- }
-
dev->regs_base = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(dev->regs_base))
return PTR_ERR(dev->regs_base);
--
1.8.1.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 2/2] [media] coda: No need to check the return value of platform_get_resource()
2013-07-20 18:48 ` [PATCH 2/2] [media] coda: No need to check the return value of platform_get_resource() Fabio Estevam
@ 2013-07-22 8:10 ` Philipp Zabel
0 siblings, 0 replies; 3+ messages in thread
From: Philipp Zabel @ 2013-07-22 8:10 UTC (permalink / raw)
To: Fabio Estevam; +Cc: k.debski, m.chehab, kernel, linux-media, Fabio Estevam
Am Samstag, den 20.07.2013, 15:48 -0300 schrieb Fabio Estevam:
> From: Fabio Estevam <fabio.estevam@freescale.com>
>
> When using devm_ioremap_resource(), we do not need to check the return value of
> platform_get_resource(), so just remove it.
>
> Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
> ---
> drivers/media/platform/coda.c | 5 -----
> 1 file changed, 5 deletions(-)
>
> diff --git a/drivers/media/platform/coda.c b/drivers/media/platform/coda.c
> index dd76228..236385f 100644
> --- a/drivers/media/platform/coda.c
> +++ b/drivers/media/platform/coda.c
> @@ -2038,11 +2038,6 @@ static int coda_probe(struct platform_device *pdev)
>
> /* Get memory for physical registers */
> res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> - if (res == NULL) {
> - dev_err(&pdev->dev, "failed to get memory region resource\n");
> - return -ENOENT;
> - }
> -
> dev->regs_base = devm_ioremap_resource(&pdev->dev, res);
> if (IS_ERR(dev->regs_base))
> return PTR_ERR(dev->regs_base);
Acked-by: Philipp Zabel <p.zabel@pengutronix.de>
regards
Philipp
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-07-22 8:10 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-07-20 18:48 [PATCH 1/2] [media] coda: Check the return value from clk_prepare_enable() Fabio Estevam
2013-07-20 18:48 ` [PATCH 2/2] [media] coda: No need to check the return value of platform_get_resource() Fabio Estevam
2013-07-22 8:10 ` Philipp Zabel
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).