'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 <kra...@redhat.com> Signed-off-by: Daniel Henrique Barboza <danielhb...@gmail.com> --- 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