qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Jason Wang <jasowang@redhat.com>
To: qemu-devel@nongnu.org, peter.maydell@linaro.org
Cc: "Jason Wang" <jasowang@redhat.com>,
	"Philippe Mathieu-Daudé" <philmd@redhat.com>
Subject: [PULL 06/13] hw/net/rtl8139: Simplify if/else statement
Date: Fri, 27 Mar 2020 19:14:00 +0800	[thread overview]
Message-ID: <1585307647-24456-7-git-send-email-jasowang@redhat.com> (raw)
In-Reply-To: <1585307647-24456-1-git-send-email-jasowang@redhat.com>

From: Philippe Mathieu-Daudé <philmd@redhat.com>

Rewrite:

      if (E) {
          return A;
      } else {
          return B;
      }
      /* EOF */
  }

as:

      if (E) {
          return A;
      }
      return B;
  }

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Reviewed-by: Cédric Le Goater <clg@kaod.org>
Signed-off-by: Jason Wang <jasowang@redhat.com>
---
 hw/net/rtl8139.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/hw/net/rtl8139.c b/hw/net/rtl8139.c
index ae4739b..ef32115 100644
--- a/hw/net/rtl8139.c
+++ b/hw/net/rtl8139.c
@@ -808,11 +808,11 @@ static int rtl8139_can_receive(NetClientState *nc)
         /* ??? Flow control not implemented in c+ mode.
            This is a hack to work around slirp deficiencies anyway.  */
         return 1;
-    } else {
-        avail = MOD2(s->RxBufferSize + s->RxBufPtr - s->RxBufAddr,
-                     s->RxBufferSize);
-        return (avail == 0 || avail >= 1514 || (s->IntrMask & RxOverflow));
     }
+
+    avail = MOD2(s->RxBufferSize + s->RxBufPtr - s->RxBufAddr,
+                 s->RxBufferSize);
+    return avail == 0 || avail >= 1514 || (s->IntrMask & RxOverflow);
 }
 
 static ssize_t rtl8139_do_receive(NetClientState *nc, const uint8_t *buf, size_t size_, int do_interrupt)
-- 
2.5.0



  parent reply	other threads:[~2020-03-27 11:15 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-27 11:13 [PULL 00/13] Net patches Jason Wang
2020-03-27 11:13 ` [PULL 01/13] hw/net/i82596: Correct command bitmask (CID 1419392) Jason Wang
2020-03-27 11:13 ` [PULL 02/13] hw/net/i82596.c: Avoid reading off end of buffer in i82596_receive() Jason Wang
2020-03-27 11:13 ` [PULL 03/13] Fixed integer overflow in e1000e Jason Wang
2020-03-27 11:13 ` [PULL 04/13] hw/net/e1000e_core: Let e1000e_can_receive() return a boolean Jason Wang
2020-03-27 11:13 ` [PULL 05/13] hw/net/smc91c111: Let smc91c111_can_receive() " Jason Wang
2020-03-27 11:14 ` Jason Wang [this message]
2020-03-27 11:14 ` [PULL 07/13] hw/net/rtl8139: Update coding style to make checkpatch.pl happy Jason Wang
2020-03-27 11:14 ` [PULL 08/13] hw/net: Make NetCanReceive() return a boolean Jason Wang
2020-03-27 11:14 ` [PULL 09/13] hw/net/can: Make CanBusClientInfo::can_receive() " Jason Wang
2020-03-27 11:14 ` [PULL 10/13] net/colo-compare.c: Expose "compare_timeout" to users Jason Wang
2020-03-27 11:14 ` [PULL 11/13] net/colo-compare.c: Expose "expired_scan_cycle" " Jason Wang
2020-03-27 11:14 ` [PULL 12/13] net: tulip: check frame size and r/w data length Jason Wang
2020-03-27 11:14 ` [PULL 13/13] hw/net/allwinner-sun8i-emac.c: Fix REG_ADDR_HIGH/LOW reads Jason Wang
2020-03-27 11:36 ` [PULL 00/13] Net patches Peter Maydell
2020-03-30  9:47   ` Jason Wang
2020-03-27 12:03 ` no-reply
2020-03-27 12:05 ` no-reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1585307647-24456-7-git-send-email-jasowang@redhat.com \
    --to=jasowang@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=philmd@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).