[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <354f7760-7b43-8e3f-414b-1556dabbcdb3@linux.intel.com>
Date: Wed, 25 Aug 2021 11:57:25 +0200
From: Thomas Hellström
<thomas.hellstrom@...ux.intel.com>
To: Nathan Chancellor <nathan@...nel.org>,
Jani Nikula <jani.nikula@...ux.intel.com>,
Joonas Lahtinen <joonas.lahtinen@...ux.intel.com>,
Rodrigo Vivi <rodrigo.vivi@...el.com>
Cc: Jason Ekstrand <jason@...kstrand.net>,
Matthew Auld <matthew.auld@...el.com>,
"Michael J. Ruhl" <michael.j.ruhl@...el.com>,
Nick Desaulniers <ndesaulniers@...gle.com>,
intel-gfx@...ts.freedesktop.org, dri-devel@...ts.freedesktop.org,
linux-kernel@...r.kernel.org, clang-built-linux@...glegroups.com,
llvm@...ts.linux.dev, Dan Carpenter <dan.carpenter@...cle.com>
Subject: Re: [PATCH 2/3] drm/i915/selftests: Always initialize err in
igt_dmabuf_import_same_driver_lmem()
On 8/25/21 12:54 AM, Nathan Chancellor wrote:
> Clang warns:
>
> drivers/gpu/drm/i915/gem/selftests/i915_gem_dmabuf.c:127:13: warning:
> variable 'err' is used uninitialized whenever 'if' condition is false
> [-Wsometimes-uninitialized]
> } else if (PTR_ERR(import) != -EOPNOTSUPP) {
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> drivers/gpu/drm/i915/gem/selftests/i915_gem_dmabuf.c:138:9: note:
> uninitialized use occurs here
> return err;
> ^~~
> drivers/gpu/drm/i915/gem/selftests/i915_gem_dmabuf.c:127:9: note: remove
> the 'if' if its condition is always true
> } else if (PTR_ERR(import) != -EOPNOTSUPP) {
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> drivers/gpu/drm/i915/gem/selftests/i915_gem_dmabuf.c:95:9: note:
> initialize the variable 'err' to silence this warning
> int err;
> ^
> = 0
>
> The test is expected to pass if i915_gem_prime_import() returns
> -EOPNOTSUPP so initialize err to zero in this case.
>
> Fixes: cdb35d1ed6d2 ("drm/i915/gem: Migrate to system at dma-buf attach time (v7)")
> Reported-by: Dan Carpenter <dan.carpenter@...cle.com>
> Signed-off-by: Nathan Chancellor <nathan@...nel.org>
Reviewed-by: Thomas Hellström <thomas.hellstrom@...ux.intel.com>
Powered by blists - more mailing lists