qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] hw/tpm/tpm_passthrough: Simplify if-statements a little bit
@ 2016-10-12 15:33 Thomas Huth
  2016-10-12 16:10 ` Peter Maydell
  2016-10-15 12:32 ` Michael Tokarev
  0 siblings, 2 replies; 3+ messages in thread
From: Thomas Huth @ 2016-10-12 15:33 UTC (permalink / raw)
  To: qemu-devel, qemu-trivial; +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 <thuth@redhat.com>
---
 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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH] hw/tpm/tpm_passthrough: Simplify if-statements a little bit
  2016-10-12 15:33 [Qemu-devel] [PATCH] hw/tpm/tpm_passthrough: Simplify if-statements a little bit Thomas Huth
@ 2016-10-12 16:10 ` Peter Maydell
  2016-10-15 12:32 ` Michael Tokarev
  1 sibling, 0 replies; 3+ messages in thread
From: Peter Maydell @ 2016-10-12 16:10 UTC (permalink / raw)
  To: Thomas Huth; +Cc: QEMU Developers, QEMU Trivial, Stefan Berger

On 12 October 2016 at 16:33, Thomas Huth <thuth@redhat.com> wrote:
> The condition  '!A || (A && B)' is equivalent to '!A || B'
>
> Buglink: https://bugs.launchpad.net/qemu/+bug/1464611
> Signed-off-by: Thomas Huth <thuth@redhat.com>

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>

thanks
-- PMM

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH] hw/tpm/tpm_passthrough: Simplify if-statements a little bit
  2016-10-12 15:33 [Qemu-devel] [PATCH] hw/tpm/tpm_passthrough: Simplify if-statements a little bit Thomas Huth
  2016-10-12 16:10 ` Peter Maydell
@ 2016-10-15 12:32 ` Michael Tokarev
  1 sibling, 0 replies; 3+ messages in thread
From: Michael Tokarev @ 2016-10-15 12:32 UTC (permalink / raw)
  To: Thomas Huth, qemu-devel, qemu-trivial; +Cc: Stefan Berger

Applied to -trivial, thank you!

/mjt

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-10-15 12:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-10-12 15:33 [Qemu-devel] [PATCH] hw/tpm/tpm_passthrough: Simplify if-statements a little bit Thomas Huth
2016-10-12 16:10 ` Peter Maydell
2016-10-15 12:32 ` Michael Tokarev

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).