]> git.baikalelectronics.ru Git - kernel.git/commit
drm/i915/selftests: Always initialize err in igt_dmabuf_import_same_driver_lmem()
authorNathan Chancellor <nathan@kernel.org>
Tue, 24 Aug 2021 22:54:26 +0000 (15:54 -0700)
committerJani Nikula <jani.nikula@intel.com>
Tue, 14 Sep 2021 16:44:07 +0000 (19:44 +0300)
commit6aa94a8f016a1db5c159a410257a6389bc8261ab
tree5892a2c22c6cbc2f6df19646950920d98ca8c5ab
parenteb0bc3a79802c27eb7420b90799fad9cfed1f46b
drm/i915/selftests: Always initialize err in igt_dmabuf_import_same_driver_lmem()

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: 456d9605a14a ("drm/i915/gem: Migrate to system at dma-buf attach time (v7)")
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20210824225427.2065517-3-nathan@kernel.org
drivers/gpu/drm/i915/gem/selftests/i915_gem_dmabuf.c