Fix new clang 10.0.0 warnings about converting the result of shift
operations to a boolean in tpm(4): sys/dev/tpm/tpm_crb.c:301:32: error: converting the result of '<<' to a boolean; did you mean '(1 << (0)) != 0'? [-Werror,-Wint-in-bool-context] WR4(sc, TPM_CRB_CTRL_CANCEL, !TPM_CRB_CTRL_CANCEL_CMD); ^ sys/dev/tpm/tpm_crb.c:73:34: note: expanded from macro 'TPM_CRB_CTRL_CANCEL_CMD' #define TPM_CRB_CTRL_CANCEL_CMD BIT(0) ^ sys/dev/tpm/tpm20.h:60:19: note: expanded from macro 'BIT' #define BIT(x) (1 << (x)) ^ In this case, the intent was to clear the zeroth bit, and leave the rest unaffected. Therefore, the ~ operator should be used instead. Noticed by: cem MFC after: 3 days
This commit is contained in:
parent
f6d5b31f8b
commit
13ae20a8a1
@ -298,7 +298,7 @@ tpmcrb_cancel_cmd(struct tpm_sc *sc)
|
||||
return (false);
|
||||
}
|
||||
|
||||
WR4(sc, TPM_CRB_CTRL_CANCEL, !TPM_CRB_CTRL_CANCEL_CMD);
|
||||
WR4(sc, TPM_CRB_CTRL_CANCEL, ~TPM_CRB_CTRL_CANCEL_CMD);
|
||||
return (true);
|
||||
}
|
||||
|
||||
@ -330,7 +330,7 @@ tpmcrb_transmit(struct tpm_sc *sc, size_t length)
|
||||
return (EIO);
|
||||
}
|
||||
/* Clear cancellation bit */
|
||||
WR4(sc, TPM_CRB_CTRL_CANCEL, !TPM_CRB_CTRL_CANCEL_CMD);
|
||||
WR4(sc, TPM_CRB_CTRL_CANCEL, ~TPM_CRB_CTRL_CANCEL_CMD);
|
||||
|
||||
/* Switch device to idle state if necessary */
|
||||
if (!(RD4(sc, TPM_CRB_CTRL_STS) & TPM_CRB_CTRL_STS_IDLE_BIT)) {
|
||||
|
Loading…
Reference in New Issue
Block a user