[PATCH] Initialize __expected to 0 in RING_LOCALS.

Matt Turner mattst88 at gmail.com
Tue Apr 6 07:19:36 PDT 2010


On Mon, Apr 5, 2010 at 2:11 PM, Cyril Brulebois <kibi at debian.org> wrote:
> This avoids some noise during building:
>    CC     radeon_accel.lo
>  radeon_accel.c: In function ‘RADEONHostDataBlit’:
>  radeon_accel.c:855: warning: ‘__expected’ may be used uninitialized in this function
>
> Signed-off-by: Cyril Brulebois <kibi at debian.org>
> ---
>  src/radeon.h |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/src/radeon.h b/src/radeon.h
> index 88f1516..d73329d 100644
> --- a/src/radeon.h
> +++ b/src/radeon.h
> @@ -1425,7 +1425,7 @@ do {                                                                      \
>
>  #define RADEON_VERBOSE 0
>
> -#define RING_LOCALS    uint32_t *__head = NULL; int __expected; int __count = 0
> +#define RING_LOCALS    uint32_t *__head = NULL; int __expected = 0; int __count = 0
>
>  #define BEGIN_RING(n) do {                                             \
>     if (RADEON_VERBOSE) {                                              \
> --
> 1.7.0.3
>
> _______________________________________________
> xorg-driver-ati mailing list
> xorg-driver-ati at lists.x.org
> http://lists.x.org/mailman/listinfo/xorg-driver-ati
>

Someone else double check me, but I don't think there's anything wrong
with this. It looks like the warning is bogus.

__expected only appears in the RING_LOCALS, BEGIN_RING, and
ADVANCE_RING macros (src/radeon.h).

__expected is initialized in BEGIN_RING in the if (!info->cs) path.
Then it's only used in the if (!info->cs) path in ADVANCE_RING.

I'm not familiar with this code, but the only case that __expected
could be uninitialized is if at the time of BEGIN_RING info->cs was
true, and at the time of ADVANCE_RING info->cs was false.

Someone else give it a look.

Matt


More information about the xorg-driver-ati mailing list