Re: [PATCH v2] tpm/st33zp24: Fix the name collisions in tpm_st33zp24_spi and tpm_i2c_infineon

From: kbuild test robot
Date: Tue Feb 05 2019 - 03:11:38 EST


Hi Jarkko,

I love your patch! Yet something to improve:

[auto build test ERROR on jss-tpmdd/next]
[also build test ERROR on v5.0-rc4 next-20190204]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url: https://github.com/0day-ci/linux/commits/Jarkko-Sakkinen/tpm-st33zp24-Fix-the-name-collisions-in-tpm_st33zp24_spi-and-tpm_i2c_infineon/20190205-150003
base: git://git.infradead.org/users/jjs/linux-tpmdd next
config: x86_64-randconfig-x013-201905 (attached as .config)
compiler: gcc-8 (Debian 8.2.0-14) 8.2.0
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64

All errors (new ones prefixed by >>):

drivers/char//tpm/tpm_i2c_infineon.c: In function 'tpm_tis_i2c_send':
>> drivers/char//tpm/tpm_i2c_infineon.c:531:12: error: 'TPM_I2C_INFINEON_BUFSIZE' undeclared (first use in this function); did you mean 'TPM_I2C_INFINEON_MAX_BUFSIZE'?
if (len > TPM_I2C_INFINEON_BUFSIZE)
^~~~~~~~~~~~~~~~~~~~~~~~
TPM_I2C_INFINEON_MAX_BUFSIZE
drivers/char//tpm/tpm_i2c_infineon.c:531:12: note: each undeclared identifier is reported only once for each function it appears in

vim +531 drivers/char//tpm/tpm_i2c_infineon.c

522
523 static int tpm_tis_i2c_send(struct tpm_chip *chip, u8 *buf, size_t len)
524 {
525 int rc, status;
526 ssize_t burstcnt;
527 size_t count = 0;
528 u8 retries = 0;
529 u8 sts = TPM_STS_GO;
530
> 531 if (len > TPM_I2C_INFINEON_BUFSIZE)
532 return -E2BIG;
533
534 if (request_locality(chip, 0) < 0)
535 return -EBUSY;
536
537 status = tpm_tis_i2c_status(chip);
538 if ((status & TPM_STS_COMMAND_READY) == 0) {
539 tpm_tis_i2c_ready(chip);
540 if (wait_for_stat
541 (chip, TPM_STS_COMMAND_READY,
542 chip->timeout_b, &status) < 0) {
543 rc = -ETIME;
544 goto out_err;
545 }
546 }
547
548 while (count < len - 1) {
549 burstcnt = get_burstcount(chip);
550
551 /* burstcnt < 0 = TPM is busy */
552 if (burstcnt < 0)
553 return burstcnt;
554
555 if (burstcnt > (len - 1 - count))
556 burstcnt = len - 1 - count;
557
558 rc = iic_tpm_write(TPM_DATA_FIFO(tpm_dev.locality),
559 &(buf[count]), burstcnt);
560 if (rc == 0)
561 count += burstcnt;
562 else if (rc < 0)
563 retries++;
564
565 /* avoid endless loop in case of broken HW */
566 if (retries > MAX_COUNT_LONG) {
567 rc = -EIO;
568 goto out_err;
569 }
570
571 wait_for_stat(chip, TPM_STS_VALID,
572 chip->timeout_c, &status);
573
574 if ((status & TPM_STS_DATA_EXPECT) == 0) {
575 rc = -EIO;
576 goto out_err;
577 }
578 }
579
580 /* write last byte */
581 iic_tpm_write(TPM_DATA_FIFO(tpm_dev.locality), &(buf[count]), 1);
582 wait_for_stat(chip, TPM_STS_VALID, chip->timeout_c, &status);
583 if ((status & TPM_STS_DATA_EXPECT) != 0) {
584 rc = -EIO;
585 goto out_err;
586 }
587
588 /* go and do it */
589 iic_tpm_write(TPM_STS(tpm_dev.locality), &sts, 1);
590
591 return len;
592 out_err:
593 tpm_tis_i2c_ready(chip);
594 /* The TPM needs some time to clean up here,
595 * so we sleep rather than keeping the bus busy
596 */
597 usleep_range(SLEEP_DURATION_RESET_LOW, SLEEP_DURATION_RESET_HI);
598 release_locality(chip, tpm_dev.locality, 0);
599 return rc;
600 }
601

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

Attachment: .config.gz
Description: application/gzip