summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorriastradh <riastradh@NetBSD.org>2021-06-02 21:35:17 +0000
committerriastradh <riastradh@NetBSD.org>2021-06-02 21:35:17 +0000
commita6ba46b079ed737605d2491b663dbbe5fb174f87 (patch)
tree470a9bbdfed9e45eba5eaa4fac32fc79500689f4 /sys/dev
parenta72917f8df0f623d9f3382eec8507fb07275075f (diff)
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 (limited to 'sys/dev')
-rw-r--r--sys/dev/ic/tpm.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/sys/dev/ic/tpm.c b/sys/dev/ic/tpm.c
index 56d98f2648d..98868fc4ce9 100644
--- a/sys/dev/ic/tpm.c
+++ b/sys/dev/ic/tpm.c
@@ -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 rw, int err)
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 rw, int err)
err ? TPM_STS_CMD_READY : TPM_STS_GO);
}
- return rv;
+out: return err ? err : rv;
}
const struct tpm_intf tpm_intf_tis12 = {