Skip to contentSkip to conversation

drm/exynos: fix a timeout loop

PATCH In review Dan Carpenter 2 participants 2 messages Oct 13, 2016

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

PATCH 1/1 drm/exynos: fix a timeout loop

We were trying to print an error message if we timed out here, but the loop actually ends with "tries" set to UINT_MAX and not zero. Fix this by changing from tries-- to --tries.

A for loop would actually be the most natural way to do this. My fix means we only loop 99 times instead of 100 but that's probably ok.

Fixes a696394c5224 ('drm/exynos: mixer: simplify loop in vp_win_reset()')
drivers/gpu/drm/exynos/exynos_mixer.c +1 -1
index edb20a3..fcc7e4f 100644
@@ -701,7 +701,7 @@ static void vp_win_reset(struct mixer_context *ctx)
 	unsigned int tries = 100;
 
 	vp_reg_write(res, VP_SRESET, VP_SRESET_PROCESSING);
-	while (tries--) {
+	while (--tries) {
 		/* waiting until VP_SRESET_PROCESSING is 0 */
 		if (~vp_reg_read(res, VP_SRESET) & VP_SRESET_PROCESSING)
 			break;
Reviewed-by on v1 1/1
#1 lore raw

Hello Dan,

sorry for the blunder! Patch looks good to me.

With best wishes,
Tobias

Quoted 28 lines · Dan Carpenter

We were trying to print an error message if we timed out here, but the loop actually ends with "tries" set to UINT_MAX and not zero. Fix this by changing from tries-- to --tries.

A for loop would actually be the most natural way to do this. My fix means we only loop 99 times instead of 100 but that's probably ok.

Fixes a696394c5224 ('drm/exynos: mixer: simplify loop in vp_win_reset()')
drivers/gpu/drm/exynos/exynos_mixer.c +1 -2
index edb20a3..fcc7e4f 100644
@@ -701,7 +701,7 @@ static void vp_win_reset(struct mixer_context *ctx)
 	unsigned int tries = 100;
 
 	vp_reg_write(res, VP_SRESET, VP_SRESET_PROCESSING);
-	while (tries--) {
+	while (--tries) {
 		/* waiting until VP_SRESET_PROCESSING is 0 */
 		if (~vp_reg_read(res, VP_SRESET) & VP_SRESET_PROCESSING)
 			break;
--

To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html