Message ID | 1484931272-20113-1-git-send-email-tjakobi@math.uni-bielefeld.de (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
2017년 01월 21일 01:54에 Tobias Jakobi 이(가) 쓴 글: > From: Dan Carpenter <dan.carpenter@oracle.com> > > 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. Sorry but I already know this patch from long ago but I'm not clear yet. How the variable, tries, could have UNIT_MAX? Seems something I'm missing. Thanks. > > 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()') > Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> > Reviewed-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de> > --- > drivers/gpu/drm/exynos/exynos_mixer.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c b/drivers/gpu/drm/exynos/exynos_mixer.c > index edb20a3..fcc7e4f 100644 > --- a/drivers/gpu/drm/exynos/exynos_mixer.c > +++ b/drivers/gpu/drm/exynos/exynos_mixer.c > @@ -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; >
On Mon, Jan 23, 2017 at 06:32:16PM +0900, Inki Dae wrote: > > > 2017년 01월 21일 01:54에 Tobias Jakobi 이(가) 쓴 글: > > From: Dan Carpenter <dan.carpenter@oracle.com> > > > > 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. > > Sorry but I already know this patch from long ago but I'm not clear yet. > How the variable, tries, could have UNIT_MAX? The value of tries after the final loop is -1u. The WARN fires on a succesful read on the final loop, instead of the complete failure. -Chris
2017년 01월 23일 18:41에 Chris Wilson 이(가) 쓴 글: > On Mon, Jan 23, 2017 at 06:32:16PM +0900, Inki Dae wrote: >> >> >> 2017년 01월 21일 01:54에 Tobias Jakobi 이(가) 쓴 글: >>> From: Dan Carpenter <dan.carpenter@oracle.com> >>> >>> 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. >> >> Sorry but I already know this patch from long ago but I'm not clear yet. >> How the variable, tries, could have UNIT_MAX? > > The value of tries after the final loop is -1u. The WARN fires on a > succesful read on the final loop, instead of the complete failure. Ah, right. thanks. > -Chris >
diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c b/drivers/gpu/drm/exynos/exynos_mixer.c index edb20a3..fcc7e4f 100644 --- a/drivers/gpu/drm/exynos/exynos_mixer.c +++ b/drivers/gpu/drm/exynos/exynos_mixer.c @@ -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;