[PATCH i-g-t] tests/intel: Drop unused local variables

Dixit, Ashutosh ashutosh.dixit at intel.com
Thu Aug 1 23:17:11 UTC 2024


On Thu, 01 Aug 2024 15:52:24 -0700, Matt Roper wrote:
>
> After applying igt.cocci to the Intel tests, several open-coded swap
> implementations were replaced with calls to igt_swap, leaving behind
> unused local variables.  Drop those variables to eliminate the compiler
> warnings.

Thanks for fixing this quickly, the build is clean now:

Reviewed-by: Ashutosh Dixit <ashutosh.dixit at intel.com>

>
> Cc: Ashutosh Dixit <ashutosh.dixit at intel.com>
> Fixes: dd461382e ("tests/intel: Apply igt.cocci transforms")
> Signed-off-by: Matt Roper <matthew.d.roper at intel.com>
> ---
>  tests/intel/gem_ctx_create.c        | 4 ++--
>  tests/intel/gem_exec_big.c          | 1 -
>  tests/intel/gem_exec_gttfill.c      | 1 -
>  tests/intel/gem_softpin.c           | 1 -
>  tests/intel/gem_tiled_fence_blits.c | 2 +-
>  5 files changed, 3 insertions(+), 6 deletions(-)
>
> diff --git a/tests/intel/gem_ctx_create.c b/tests/intel/gem_ctx_create.c
> index 0332ecbb9..5c2b0ef65 100644
> --- a/tests/intel/gem_ctx_create.c
> +++ b/tests/intel/gem_ctx_create.c
> @@ -295,14 +295,14 @@ static void active(int fd, const intel_ctx_cfg_t *cfg,
>
>  static void xchg_u32(void *array, unsigned i, unsigned j)
>  {
> -	uint32_t *a = array, tmp;
> +	uint32_t *a = array;
>
>	igt_swap(a[i], a[j]);
>  }
>
>  static void xchg_ptr(void *array, unsigned i, unsigned j)
>  {
> -	void **a = array, *tmp;
> +	void **a = array;
>
>	igt_swap(a[i], a[j]);
>  }
> diff --git a/tests/intel/gem_exec_big.c b/tests/intel/gem_exec_big.c
> index 86849f322..cdefce5db 100644
> --- a/tests/intel/gem_exec_big.c
> +++ b/tests/intel/gem_exec_big.c
> @@ -141,7 +141,6 @@ static void xchg_reloc(void *array, unsigned i, unsigned j)
>	struct drm_i915_gem_relocation_entry *reloc = array;
>	struct drm_i915_gem_relocation_entry *a = &reloc[i];
>	struct drm_i915_gem_relocation_entry *b = &reloc[j];
> -	struct drm_i915_gem_relocation_entry tmp;
>
>	igt_swap(*a, *b);
>  }
> diff --git a/tests/intel/gem_exec_gttfill.c b/tests/intel/gem_exec_gttfill.c
> index ff600e0ca..3f0501777 100644
> --- a/tests/intel/gem_exec_gttfill.c
> +++ b/tests/intel/gem_exec_gttfill.c
> @@ -64,7 +64,6 @@ struct batch {
>  static void xchg_batch(void *array, unsigned int i, unsigned int j)
>  {
>	struct batch *batches = array;
> -	struct batch tmp;
>
>	igt_swap(batches[i], batches[j]);
>  }
> diff --git a/tests/intel/gem_softpin.c b/tests/intel/gem_softpin.c
> index c542bf741..d8b99a2ae 100644
> --- a/tests/intel/gem_softpin.c
> +++ b/tests/intel/gem_softpin.c
> @@ -967,7 +967,6 @@ struct batch {
>  static void xchg_batch(void *array, unsigned int i, unsigned int j)
>  {
>	struct batch *batches = array;
> -	struct batch tmp;
>
>	igt_swap(batches[i], batches[j]);
>  }
> diff --git a/tests/intel/gem_tiled_fence_blits.c b/tests/intel/gem_tiled_fence_blits.c
> index f5a3d9311..c11eb73e3 100644
> --- a/tests/intel/gem_tiled_fence_blits.c
> +++ b/tests/intel/gem_tiled_fence_blits.c
> @@ -156,7 +156,7 @@ update_batch(int fd, uint32_t bb_handle,
>
>  static void xchg_u32(void *array, unsigned i, unsigned j)
>  {
> -	uint32_t tmp, *base = array;
> +	uint32_t *base = array;
>
>	igt_swap(base[i], base[j]);
>  }
> --
> 2.45.2
>


More information about the igt-dev mailing list