]> git.baikalelectronics.ru Git - kernel.git/commit
i2c: designware: Fix improper usage of readl
authorJan Dabros <jsd@semihalf.com>
Fri, 18 Feb 2022 13:33:48 +0000 (14:33 +0100)
committerWolfram Sang <wsa@kernel.org>
Tue, 1 Mar 2022 15:12:42 +0000 (16:12 +0100)
commitf72923c366c3c353bddef3b0d71ddba6418eeb6d
treeec3c3e3639ee9c453e30366cd3c9be65b94c721a
parent3d30f5372104d871de584a41c1c4d3fb60d49fa8
i2c: designware: Fix improper usage of readl

Kernel test robot reported incorrect type in argument 1 of readl(), but
more importantly it brought attention that MMIO accessor shouldn't be
used in this case, since req->hdr.status is part of a command-response
buffer in system memory.

Since its value may be altered by PSP outside of the scope of current
thread (somehow similar to IRQ handler case), we need to use
READ_ONCE() to ensure compiler won't optimize this call.

Fix also 'status' variable type to reflect that corresponding field in
command-response buffer is platform-independent u32.

Fixes: 54d4ff095931 ("i2c: designware: Add AMD PSP I2C bus support")
Signed-off-by: Jan Dabros <jsd@semihalf.com>
Reported-by: kernel test robot <lkp@intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
Signed-off-by: Wolfram Sang <wsa@kernel.org>
drivers/i2c/busses/i2c-designware-amdpsp.c