qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH v1 39/59] usb/dev-mtp.c: remove unneeded label in write_retry()


From: Daniel Henrique Barboza
Subject: [PATCH v1 39/59] usb/dev-mtp.c: remove unneeded label in write_retry()
Date: Mon, 6 Jan 2020 15:24:05 -0300

'done' can be replaced by 'return 0'. The 'ret' variable can
be removed since it's only set in qemu_write_full(), which
is now the returned value of the function.

write_retry() body also has an extra layer of identation. Let's
fix that to make it compliant with the other functions in the
file.

CC: Gerd Hoffmann <address@hidden>
Signed-off-by: Daniel Henrique Barboza <address@hidden>
---
 hw/usb/dev-mtp.c | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/hw/usb/dev-mtp.c b/hw/usb/dev-mtp.c
index 7c07295519..818aa066c9 100644
--- a/hw/usb/dev-mtp.c
+++ b/hw/usb/dev-mtp.c
@@ -1576,16 +1576,11 @@ static char *utf16_to_str(uint8_t len, uint8_t *str16)
 /* Wrapper around write, returns 0 on failure */
 static uint64_t write_retry(int fd, void *buf, uint64_t size, off_t offset)
 {
-        uint64_t ret = 0;
-
-        if (lseek(fd, offset, SEEK_SET) < 0) {
-            goto done;
-        }
-
-        ret = qemu_write_full(fd, buf, size);
+    if (lseek(fd, offset, SEEK_SET) < 0) {
+        return 0;
+    }
 
-done:
-        return ret;
+    return qemu_write_full(fd, buf, size);
 }
 
 static int usb_mtp_update_object(MTPObject *parent, char *name)
-- 
2.24.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]