public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm: atmel-hlcdc: Uninitialized return in atmel_hlcdc_create_outputs()
@ 2017-04-15 19:21 Dan Carpenter
  2017-04-18  8:00 ` Boris Brezillon
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2017-04-15 19:21 UTC (permalink / raw)
  To: Boris Brezillon, Rob Herring; +Cc: David Airlie, dri-devel, kernel-janitors

It's not possible for endpoint to be zero so the test doesn't work.  If
we break on the first iteration through the loop then endpoint is 1 and
"ret" is uninitialized.

Fixes: ebc944613567 ("drm: convert drivers to use drm_of_find_panel_or_bridge")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_output.c b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_output.c
index f987b4572d4a..65a3bd7a0c00 100644
--- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_output.c
+++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_output.c
@@ -221,7 +221,8 @@ static int atmel_hlcdc_attach_endpoint(struct drm_device *dev,
 int atmel_hlcdc_create_outputs(struct drm_device *dev)
 {
 	struct device_node *remote;
-	int ret, endpoint = 0;
+	int ret = -ENODEV;
+	int endpoint = 0;
 
 	while (true) {
 		/* Loop thru possible multiple connections to the output */
@@ -236,7 +237,5 @@ int atmel_hlcdc_create_outputs(struct drm_device *dev)
 			return ret;
 	}
 
-	if (!endpoint)
-		return -ENODEV;
 	return ret;
 }

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

* Re: [PATCH] drm: atmel-hlcdc: Uninitialized return in atmel_hlcdc_create_outputs()
  2017-04-15 19:21 [PATCH] drm: atmel-hlcdc: Uninitialized return in atmel_hlcdc_create_outputs() Dan Carpenter
@ 2017-04-18  8:00 ` Boris Brezillon
  0 siblings, 0 replies; 2+ messages in thread
From: Boris Brezillon @ 2017-04-18  8:00 UTC (permalink / raw)
  To: Dan Carpenter, Daniel Vetter; +Cc: kernel-janitors, dri-devel

On Sat, 15 Apr 2017 22:21:42 +0300
Dan Carpenter <dan.carpenter@oracle.com> wrote:

> It's not possible for endpoint to be zero so the test doesn't work.  If
> we break on the first iteration through the loop then endpoint is 1 and
> "ret" is uninitialized.
> 
> Fixes: ebc944613567 ("drm: convert drivers to use drm_of_find_panel_or_bridge")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Acked-by: Boris Brezillon <boris.brezillon@free-electrons.com>

Daniel, should I directly apply this patch to drm-misc-next-fixes or
should I wait for someone else to take it?

> 
> diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_output.c b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_output.c
> index f987b4572d4a..65a3bd7a0c00 100644
> --- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_output.c
> +++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_output.c
> @@ -221,7 +221,8 @@ static int atmel_hlcdc_attach_endpoint(struct drm_device *dev,
>  int atmel_hlcdc_create_outputs(struct drm_device *dev)
>  {
>  	struct device_node *remote;
> -	int ret, endpoint = 0;
> +	int ret = -ENODEV;
> +	int endpoint = 0;
>  
>  	while (true) {
>  		/* Loop thru possible multiple connections to the output */
> @@ -236,7 +237,5 @@ int atmel_hlcdc_create_outputs(struct drm_device *dev)
>  			return ret;
>  	}
>  
> -	if (!endpoint)
> -		return -ENODEV;
>  	return ret;
>  }


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

end of thread, other threads:[~2017-04-18  8:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-04-15 19:21 [PATCH] drm: atmel-hlcdc: Uninitialized return in atmel_hlcdc_create_outputs() Dan Carpenter
2017-04-18  8:00 ` Boris Brezillon

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