Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/ic tpm(4): Preserve error if any on ending commands.



details:   https://anonhg.NetBSD.org/src/rev/cd731d9a20cd
branches:  trunk
changeset: 379488:cd731d9a20cd
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Wed Jun 02 21:35:17 2021 +0000

description:
tpm(4): Preserve error if any on ending commands.

This way we don't spuriously suppress an error, such as
TPM_DEACTIVATED, in a loop where we rely on it.

diffstat:

 sys/dev/ic/tpm.c |  8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diffs (36 lines):

diff -r 87fc278c178b -r cd731d9a20cd sys/dev/ic/tpm.c
--- a/sys/dev/ic/tpm.c  Wed Jun 02 21:34:58 2021 +0000
+++ b/sys/dev/ic/tpm.c  Wed Jun 02 21:35:17 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tpm.c,v 1.21 2021/05/29 08:45:29 riastradh Exp $       */
+/*     $NetBSD: tpm.c,v 1.22 2021/06/02 21:35:17 riastradh Exp $       */
 
 /*
  * Copyright (c) 2019 The NetBSD Foundation, Inc.
@@ -48,7 +48,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tpm.c,v 1.21 2021/05/29 08:45:29 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tpm.c,v 1.22 2021/06/02 21:35:17 riastradh Exp $");
 
 #include <sys/param.h>
 #include <sys/types.h>
@@ -811,7 +811,7 @@ tpm_tis12_end(struct tpm_softc *sc, int 
        if (rw == UIO_READ) {
                rv = tpm_waitfor(sc, TPM_STS_VALID, TPM_READ_TMO, sc->sc_intf->read);
                if (rv)
-                       return rv;
+                       goto out;
 
                /* Still more data? */
                sc->sc_status = tpm_status(sc);
@@ -836,7 +836,7 @@ tpm_tis12_end(struct tpm_softc *sc, int 
                    err ? TPM_STS_CMD_READY : TPM_STS_GO);
        }
 
-       return rv;
+out:   return err ? err : rv;
 }
 
 const struct tpm_intf tpm_intf_tis12 = {



Home | Main Index | Thread Index | Old Index