Skip to contentSkip to conversation

drm: atmel-hlcdc: Uninitialized return in atmel_hlcdc_create_outputs()

PATCH In review Dan Carpenter 2 participants 2 messages Apr 15, 2017 – Apr 18, 2017

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm: atmel-hlcdc: Uninitialized return in atmel_hlcdc_create_outputs()

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")
drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_output.c +2 -3
index f987b4572d4a..65a3bd7a0c00 100644
@@ -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;
 }
Acked-by on v1 1/1
#1 lore raw
Quoted 6 lines · On Sat, 15 Apr 2017 22:21:42 +0300 Dan Carpenter <[email protected]>…

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")

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

Quoted 23 lines
drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_output.c +2 -3
index f987b4572d4a..65a3bd7a0c00 100644
@@ -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;
 }