net/eth: Add an assert() and invert if() statement to simplify code
commitc7274b5ef43614dd133daec1e2018f71d8744088
authorPhilippe Mathieu-Daudé <philmd@redhat.com>
Wed, 10 Mar 2021 18:31:23 +0000 (10 19:31 +0100)
committerJason Wang <jasowang@redhat.com>
Mon, 22 Mar 2021 09:34:31 +0000 (22 17:34 +0800)
treef2ef7b30f251f503dd209bd9a5b62b5e6a2c2e21
parent7d6a4f123e00c9dbd40867ae1a650a4fd0bc4a3d
net/eth: Add an assert() and invert if() statement to simplify code

To simplify the function body, invert the if() statement, returning
earlier.
Since we already checked there is enough data in the iovec buffer,
simply add an assert() call to consume the bytes_read variable.

Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
Reviewed-by: Miroslav Rezanina <mrezanin@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
net/eth.c