From 077f63bf918f7370ef9c9f0eeffffe7a763494d0 Mon Sep 17 00:00:00 2001 From: Taylor R Campbell Date: Wed, 2 Jun 2021 09:09:20 +0000 Subject: [PATCH] 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. --- sys/dev/ic/tpm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/dev/ic/tpm.c b/sys/dev/ic/tpm.c index 1f833d085bd0..b471d25b592a 100644 --- a/sys/dev/ic/tpm.c +++ b/sys/dev/ic/tpm.c @@ -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 = {