From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55286) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1buLXT-0003XW-UL for qemu-devel@nongnu.org; Wed, 12 Oct 2016 11:33:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1buLXP-00087H-W1 for qemu-devel@nongnu.org; Wed, 12 Oct 2016 11:33:51 -0400 From: Thomas Huth Date: Wed, 12 Oct 2016 17:33:44 +0200 Message-Id: <1476286424-9744-1-git-send-email-thuth@redhat.com> Subject: [Qemu-devel] [PATCH] hw/tpm/tpm_passthrough: Simplify if-statements a little bit List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org, qemu-trivial@nongnu.org Cc: Stefan Berger The condition '!A || (A && B)' is equivalent to '!A || B' Buglink: https://bugs.launchpad.net/qemu/+bug/1464611 Signed-off-by: Thomas Huth --- hw/tpm/tpm_passthrough.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/hw/tpm/tpm_passthrough.c b/hw/tpm/tpm_passthrough.c index e88c0d2..9234eb3 100644 --- a/hw/tpm/tpm_passthrough.c +++ b/hw/tpm/tpm_passthrough.c @@ -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); -- 1.8.3.1