mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 1/3] staging: drm/imx: check return value of ipu_reset()
@ 2012-12-25 14:58 Lothar Waßmann
  2012-12-25 14:58 ` [PATCH 2/3] staging: drm/imx: several bug fixes Lothar Waßmann
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Lothar Waßmann @ 2012-12-25 14:58 UTC (permalink / raw)
  To: Sascha Hauer
  Cc: Fabio Estevam, Greg Kroah-Hartman, linux-kernel, Lothar Waßmann

ipu_reset() can fail with a timeout. Check the return value and act
appropriately.

Signed-off-by: Lothar Waßmann <LW@KARO-electronics.de>
---
 drivers/staging/imx-drm/ipu-v3/ipu-common.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/drivers/staging/imx-drm/ipu-v3/ipu-common.c b/drivers/staging/imx-drm/ipu-v3/ipu-common.c
index 677e665..f7059cd 100644
--- a/drivers/staging/imx-drm/ipu-v3/ipu-common.c
+++ b/drivers/staging/imx-drm/ipu-v3/ipu-common.c
@@ -1104,7 +1104,9 @@ static int ipu_probe(struct platform_device *pdev)
 	if (ret)
 		goto out_failed_irq;
 
-	ipu_reset(ipu);
+	ret = ipu_reset(ipu);
+	if (ret)
+		goto out_failed_reset;
 
 	/* Set MCU_T to divide MCU access window into 2 */
 	ipu_cm_write(ipu, 0x00400000L | (IPU_MCU_T_DEFAULT << 18),
@@ -1129,6 +1131,7 @@ failed_add_clients:
 	ipu_submodules_exit(ipu);
 failed_submodules_init:
 	ipu_irq_exit(ipu);
+out_failed_reset:
 out_failed_irq:
 	clk_disable_unprepare(ipu->clk);
 failed_clk_get:
-- 
1.7.2.5


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 2/3] staging: drm/imx: several bug fixes
  2012-12-25 14:58 [PATCH 1/3] staging: drm/imx: check return value of ipu_reset() Lothar Waßmann
@ 2012-12-25 14:58 ` Lothar Waßmann
  2012-12-25 14:58 ` [PATCH 3/3] staging: drm/imx: fix double free bug in error path Lothar Waßmann
  2012-12-27 10:06 ` [PATCH 1/3] staging: drm/imx: check return value of ipu_reset() Sascha Hauer
  2 siblings, 0 replies; 4+ messages in thread
From: Lothar Waßmann @ 2012-12-25 14:58 UTC (permalink / raw)
  To: Sascha Hauer
  Cc: Fabio Estevam, Greg Kroah-Hartman, linux-kernel, Lothar Waßmann

- convert bogus IS_ERR_OR_NULL() to IS_ERR()
- fix copy/paste error
- check return value of ipu_crtc_init()

Signed-off-by: Lothar Waßmann <LW@KARO-electronics.de>
---
 drivers/staging/imx-drm/ipuv3-crtc.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/imx-drm/ipuv3-crtc.c b/drivers/staging/imx-drm/ipuv3-crtc.c
index 1892006..4b3a019 100644
--- a/drivers/staging/imx-drm/ipuv3-crtc.c
+++ b/drivers/staging/imx-drm/ipuv3-crtc.c
@@ -452,7 +452,7 @@ static int ipu_get_resources(struct ipu_crtc *ipu_crtc,
 	int ret;
 
 	ipu_crtc->ipu_ch = ipu_idmac_get(ipu, pdata->dma[0]);
-	if (IS_ERR_OR_NULL(ipu_crtc->ipu_ch)) {
+	if (IS_ERR(ipu_crtc->ipu_ch)) {
 		ret = PTR_ERR(ipu_crtc->ipu_ch);
 		goto err_out;
 	}
@@ -472,7 +472,7 @@ static int ipu_get_resources(struct ipu_crtc *ipu_crtc,
 	if (pdata->dp >= 0) {
 		ipu_crtc->dp = ipu_dp_get(ipu, pdata->dp);
 		if (IS_ERR(ipu_crtc->dp)) {
-			ret = PTR_ERR(ipu_crtc->ipu_ch);
+			ret = PTR_ERR(ipu_crtc->dp);
 			goto err_out;
 		}
 	}
@@ -548,6 +548,8 @@ static int ipu_drm_probe(struct platform_device *pdev)
 	ipu_crtc->dev = &pdev->dev;
 
 	ret = ipu_crtc_init(ipu_crtc, pdata);
+	if (ret)
+		return ret;
 
 	platform_set_drvdata(pdev, ipu_crtc);
 
-- 
1.7.2.5


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 3/3] staging: drm/imx: fix double free bug in error path
  2012-12-25 14:58 [PATCH 1/3] staging: drm/imx: check return value of ipu_reset() Lothar Waßmann
  2012-12-25 14:58 ` [PATCH 2/3] staging: drm/imx: several bug fixes Lothar Waßmann
@ 2012-12-25 14:58 ` Lothar Waßmann
  2012-12-27 10:06 ` [PATCH 1/3] staging: drm/imx: check return value of ipu_reset() Sascha Hauer
  2 siblings, 0 replies; 4+ messages in thread
From: Lothar Waßmann @ 2012-12-25 14:58 UTC (permalink / raw)
  To: Sascha Hauer
  Cc: Fabio Estevam, Greg Kroah-Hartman, linux-kernel, Lothar Waßmann

kfree(imx_drm_encoder) is already being called at the label
'err_register'.

Signed-off-by: Lothar Waßmann <LW@KARO-electronics.de>
---
 drivers/staging/imx-drm/imx-drm-core.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/drivers/staging/imx-drm/imx-drm-core.c b/drivers/staging/imx-drm/imx-drm-core.c
index ecf0f44..cec19f1 100644
--- a/drivers/staging/imx-drm/imx-drm-core.c
+++ b/drivers/staging/imx-drm/imx-drm-core.c
@@ -584,7 +584,6 @@ int imx_drm_add_encoder(struct drm_encoder *encoder,
 
 	ret = imx_drm_encoder_register(imx_drm_encoder);
 	if (ret) {
-		kfree(imx_drm_encoder);
 		ret = -ENOMEM;
 		goto err_register;
 	}
-- 
1.7.2.5


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/3] staging: drm/imx: check return value of ipu_reset()
  2012-12-25 14:58 [PATCH 1/3] staging: drm/imx: check return value of ipu_reset() Lothar Waßmann
  2012-12-25 14:58 ` [PATCH 2/3] staging: drm/imx: several bug fixes Lothar Waßmann
  2012-12-25 14:58 ` [PATCH 3/3] staging: drm/imx: fix double free bug in error path Lothar Waßmann
@ 2012-12-27 10:06 ` Sascha Hauer
  2 siblings, 0 replies; 4+ messages in thread
From: Sascha Hauer @ 2012-12-27 10:06 UTC (permalink / raw)
  To: Lothar Waßmann; +Cc: Fabio Estevam, Greg Kroah-Hartman, linux-kernel

On Tue, Dec 25, 2012 at 03:58:37PM +0100, Lothar Waßmann wrote:
> ipu_reset() can fail with a timeout. Check the return value and act
> appropriately.
> 
> Signed-off-by: Lothar Waßmann <LW@KARO-electronics.de>

All:

Acked-by: Sascha Hauer <s.hauer@pengutronix.de>

> ---
>  drivers/staging/imx-drm/ipu-v3/ipu-common.c |    5 ++++-
>  1 files changed, 4 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/staging/imx-drm/ipu-v3/ipu-common.c b/drivers/staging/imx-drm/ipu-v3/ipu-common.c
> index 677e665..f7059cd 100644
> --- a/drivers/staging/imx-drm/ipu-v3/ipu-common.c
> +++ b/drivers/staging/imx-drm/ipu-v3/ipu-common.c
> @@ -1104,7 +1104,9 @@ static int ipu_probe(struct platform_device *pdev)
>  	if (ret)
>  		goto out_failed_irq;
>  
> -	ipu_reset(ipu);
> +	ret = ipu_reset(ipu);
> +	if (ret)
> +		goto out_failed_reset;
>  
>  	/* Set MCU_T to divide MCU access window into 2 */
>  	ipu_cm_write(ipu, 0x00400000L | (IPU_MCU_T_DEFAULT << 18),
> @@ -1129,6 +1131,7 @@ failed_add_clients:
>  	ipu_submodules_exit(ipu);
>  failed_submodules_init:
>  	ipu_irq_exit(ipu);
> +out_failed_reset:
>  out_failed_irq:
>  	clk_disable_unprepare(ipu->clk);
>  failed_clk_get:
> -- 
> 1.7.2.5
> 
> 

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-12-27 10:06 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-12-25 14:58 [PATCH 1/3] staging: drm/imx: check return value of ipu_reset() Lothar Waßmann
2012-12-25 14:58 ` [PATCH 2/3] staging: drm/imx: several bug fixes Lothar Waßmann
2012-12-25 14:58 ` [PATCH 3/3] staging: drm/imx: fix double free bug in error path Lothar Waßmann
2012-12-27 10:06 ` [PATCH 1/3] staging: drm/imx: check return value of ipu_reset() Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®