Re: [PATCH v1] tpm_tis_spi_main: set cs_change = 0 when timesout

From: kernel test robot
Date: Fri Feb 05 2021 - 02:51:55 EST


Hi wanghongzhe,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on char-misc/char-misc-testing]
[also build test ERROR on v5.11-rc6 next-20210125]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url: https://github.com/0day-ci/linux/commits/wanghongzhe/tpm_tis_spi_main-set-cs_change-0-when-timesout/20210205-140104
base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git 3a11b0b5d8d2b3f7d4b44945ef9226a3115bb15f
config: nios2-allyesconfig (attached as .config)
compiler: nios2-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/42343d4238cfd18831ed331b153cc6d2c0a7bc33
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review wanghongzhe/tpm_tis_spi_main-set-cs_change-0-when-timesout/20210205-140104
git checkout 42343d4238cfd18831ed331b153cc6d2c0a7bc33
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=nios2

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All errors (new ones prefixed by >>):

drivers/char/tpm/tpm_tis_spi_main.c: In function 'tpm_tis_spi_flow_control':
>> drivers/char/tpm/tpm_tis_spi_main.c:72:12: error: 'spi_xfer' is a pointer; did you mean to use '->'?
72 | spi_xfer.cs_change = 0;
| ^
| ->
At top level:
drivers/char/tpm/tpm_tis_spi_main.c:288:36: warning: 'acpi_tis_spi_match' defined but not used [-Wunused-const-variable=]
288 | static const struct acpi_device_id acpi_tis_spi_match[] = {
| ^~~~~~~~~~~~~~~~~~


vim +72 drivers/char/tpm/tpm_tis_spi_main.c

40
41 /*
42 * TCG SPI flow control is documented in section 6.4 of the spec[1]. In short,
43 * keep trying to read from the device until MISO goes high indicating the
44 * wait state has ended.
45 *
46 * [1] https://trustedcomputinggroup.org/resource/pc-client-platform-tpm-profile-ptp-specification/
47 */
48 static int tpm_tis_spi_flow_control(struct tpm_tis_spi_phy *phy,
49 struct spi_transfer *spi_xfer)
50 {
51 struct spi_message m;
52 int ret, i;
53
54 if ((phy->iobuf[3] & 0x01) == 0) {
55 // handle SPI wait states
56 for (i = 0; i < TPM_RETRY; i++) {
57 spi_xfer->len = 1;
58 spi_message_init(&m);
59 spi_message_add_tail(spi_xfer, &m);
60 ret = spi_sync_locked(phy->spi_device, &m);
61 if (ret < 0)
62 return ret;
63 if (phy->iobuf[0] & 0x01)
64 break;
65 }
66
67 if (i == TPM_RETRY) {
68 /* change back to 'high',
69 * So the TPM chips thinks the last communication
70 * is done.
71 */
> 72 spi_xfer.cs_change = 0;
73 spi_xfer->len = 1;
74 spi_message_init(&m);
75 spi_message_add_tail(spi_xfer, &m);
76 ret = spi_sync_locked(phy->spi_device, &m);
77 return -ETIMEDOUT;
78 }
79 }
80
81 return 0;
82 }
83

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip