Skip to content
Verified Commit e896c048 authored by Nathan Chancellor's avatar Nathan Chancellor Committed by Mark Brown
Browse files

spi: amd: Fix -Wuninitialized in amd_spi_exec_mem_op()



After commit e6204f39 ("spi: amd: Drop redundant check"), clang warns (or
errors with CONFIG_WERROR=y):

  drivers/spi/spi-amd.c:695:9: error: variable 'ret' is uninitialized when used here [-Werror,-Wuninitialized]
    695 |         return ret;
        |                ^~~
  drivers/spi/spi-amd.c:673:9: note: initialize the variable 'ret' to silence this warning
    673 |         int ret;
        |                ^
        |                 = 0
  1 error generated.

ret is no longer set on anything other than the default switch path.
Replace ret with a direct return of 0 at the end of the function and
-EOPNOTSUPP in the default case to resolve the warning.

Fixes: e6204f39 ("spi: amd: Drop redundant check")
Reported-by: default avatarkernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202501112315.ugYQ7Ce7-lkp@intel.com/


Signed-off-by: default avatarNathan Chancellor <nathan@kernel.org>
Reviewed-by: default avatarMiguel Ojeda <ojeda@kernel.org>
Reviewed-by: default avatarMiquel Raynal <miquel.raynal@bootlin.com>
Link: https://patch.msgid.link/20250111-spi-amd-fix-uninitialized-ret-v1-1-c66ab9f6a23d@kernel.org


Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 226d6cb3
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment