hw/tpm/tpm_passthrough: Simplify if-statements a little bit
PATCH 1/1 hw/tpm/tpm_passthrough: Simplify if-statements a little bit
The condition '!A || (A && B)' is equivalent to '!A || B'
Signed-off-by Thomas Huth <[email protected]>
--- hw/tpm/tpm_passthrough.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
hw/tpm/tpm_passthrough.c +2 -4
@@ -165,8 +165,7 @@ static int tpm_passthrough_unix_tx_bufs(TPMPassthruState *tpm_pt, ret =tpm_passthrough_unix_write (tpm_pt->tpm_fd, in, in_len);if (ret != in_len) { -if (!tpm_pt->tpm_op_canceled || - (tpm_pt->tpm_op_canceled && errno !=ECANCELED )) { +if (!tpm_pt->tpm_op_canceled || errno !=ECANCELED ) {error_report ("tpm_passthrough: error while transmitting data " "to TPM: %s (%i)" ,strerror (errno), errno);
@@ -178,8 +177,7 @@ static int tpm_passthrough_unix_tx_bufs(TPMPassthruState *tpm_pt, ret =tpm_passthrough_unix_read (tpm_pt->tpm_fd, out, out_len);if (ret <0 ) { -if (!tpm_pt->tpm_op_canceled || - (tpm_pt->tpm_op_canceled && errno !=ECANCELED )) { +if (!tpm_pt->tpm_op_canceled || errno !=ECANCELED ) {error_report ("tpm_passthrough: error while reading data from " "TPM: %s (%i)" ,strerror (errno), errno);
Signature · 1 line
1.8.3.1
Quoted 4 lines · Thomas Huth
The condition '!A || (A && B)' is equivalent to '!A || B'
Signed-off-by Thomas Huth <[email protected]>
Reviewed-by Peter Maydell <[email protected]>
thanks
-- PMM
Michael Tokarev
AppliedApplied to -trivial, thank you!
/mjt