[Mesa-dev] [PATCH] radeon: Check an error return instead of assigning it to a dead variable.

Alex Deucher alexdeucher at gmail.com
Wed Nov 2 14:54:09 PDT 2011


On Wed, Nov 2, 2011 at 5:40 PM, Eric Anholt <eric at anholt.net> wrote:
> Fixes gcc set-but-unused-variable warning.

Reviewed-by: Alex Deucher <alexdeucher at gmail.com>

> ---
>  .../drivers/dri/radeon/radeon_common_context.c     |   18 +++++++++++++-----
>  1 files changed, 13 insertions(+), 5 deletions(-)
>
> diff --git a/src/mesa/drivers/dri/radeon/radeon_common_context.c b/src/mesa/drivers/dri/radeon/radeon_common_context.c
> index 2694daf..e6c7f94 100644
> --- a/src/mesa/drivers/dri/radeon/radeon_common_context.c
> +++ b/src/mesa/drivers/dri/radeon/radeon_common_context.c
> @@ -551,11 +551,19 @@ radeon_update_renderbuffers(__DRIcontext *context, __DRIdrawable *drawable,
>                        }
>
>                        ret = radeon_bo_get_tiling(bo, &tiling_flags, &pitch);
> -                       if (tiling_flags & RADEON_TILING_MACRO)
> -                               bo->flags |= RADEON_BO_FLAGS_MACRO_TILE;
> -                       if (tiling_flags & RADEON_TILING_MICRO)
> -                               bo->flags |= RADEON_BO_FLAGS_MICRO_TILE;
> -
> +                       if (ret) {
> +                               fprintf(stderr,
> +                                       "failed to get tiling for %s %d\n",
> +                                       regname, buffers[i].name);
> +                               radeon_bo_unref(bo);
> +                               bo = NULL;
> +                               continue;
> +                       } else {
> +                               if (tiling_flags & RADEON_TILING_MACRO)
> +                                       bo->flags |= RADEON_BO_FLAGS_MACRO_TILE;
> +                               if (tiling_flags & RADEON_TILING_MICRO)
> +                                       bo->flags |= RADEON_BO_FLAGS_MICRO_TILE;
> +                       }
>                }
>
>                if (buffers[i].attachment == __DRI_BUFFER_DEPTH) {
> --
> 1.7.7
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
>


More information about the mesa-dev mailing list