tpm: vtpm_proxy: Suppress error logging when in closed state
authorStefan Berger <stefanb@linux.vnet.ibm.com>
Thu, 25 May 2017 22:29:13 +0000 (18:29 -0400)
committerJarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Tue, 13 Jun 2017 19:02:09 +0000 (22:02 +0300)
Suppress the error logging when the core TPM driver sends commands
to the VTPM proxy driver and -EPIPE is returned in case the VTPM
proxy driver is 'closed' (closed anonymous file descriptor).  This
error code is only returned by the send function and by tpm_transmit
when the VTPM proxy driver is being used.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
Reviewed-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Tested-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
drivers/char/tpm/tpm-interface.c
drivers/char/tpm/tpm2-cmd.c

index be5415923886d7092266015eeea5bc951c9f6bc2..a965a9f0e5d2ea3d470f22fbd59c2e0f734f516c 100644 (file)
@@ -429,8 +429,9 @@ ssize_t tpm_transmit(struct tpm_chip *chip, struct tpm_space *space,
 
        rc = chip->ops->send(chip, (u8 *) buf, count);
        if (rc < 0) {
-               dev_err(&chip->dev,
-                       "tpm_transmit: tpm_send: error %d\n", rc);
+               if (rc != -EPIPE)
+                       dev_err(&chip->dev,
+                               "%s: tpm_send: error %d\n", __func__, rc);
                goto out;
        }
 
index 3ee6883f26c190a757ed571913ec56eaa0297ad6..3a9964326279302d7898774431d332f73d2487b8 100644 (file)
@@ -840,7 +840,7 @@ void tpm2_shutdown(struct tpm_chip *chip, u16 shutdown_type)
        /* In places where shutdown command is sent there's no much we can do
         * except print the error code on a system failure.
         */
-       if (rc < 0)
+       if (rc < 0 && rc != -EPIPE)
                dev_warn(&chip->dev, "transmit returned %d while stopping the TPM",
                         rc);
 }