From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 95D4BC433F5 for ; Fri, 17 Dec 2021 09:42:35 +0000 (UTC) Received: from localhost ([::1]:45862 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1my9l4-00027r-Jl for qemu-devel@archiver.kernel.org; Fri, 17 Dec 2021 04:42:34 -0500 Received: from eggs.gnu.org ([209.51.188.92]:54766) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1my9iR-00074D-Gd for qemu-devel@nongnu.org; Fri, 17 Dec 2021 04:39:51 -0500 Received: from smtp-out2.suse.de ([195.135.220.29]:54296) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1my9iP-0006Ld-Tr for qemu-devel@nongnu.org; Fri, 17 Dec 2021 04:39:51 -0500 Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 4ED251F38A; Fri, 17 Dec 2021 09:39:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1639733986; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=GH/RAHbUiQj9QRgnB9jWI3WQIqE7HqzQSS6PDwZG+20=; b=shIKkUDaiNmeylXiAsOHwuwNp/tixgTG7scIjeFCqiluWgJQ46ay0eynx6iWEBOmLbQJ+0 2BGyDkC3RAts9NdDocKkATJy5TfLuTh1bDorzVaUjuvIkiooCaFeyaX3/zSOK8E/nBwUrC w2PrYO4Il79Y50wCMQVDcChDInH7Big= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1639733986; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=GH/RAHbUiQj9QRgnB9jWI3WQIqE7HqzQSS6PDwZG+20=; b=WHZ5nD3qRDJqiw/2eVJeDLuqFGFMSZyjfgaymF1iun6vK17V2yoh+cqCJbdf5GHESokl/y EezA1V6dFl0Rr5Cg== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 1538313DC1; Fri, 17 Dec 2021 09:39:46 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id G7dCA+JavGEuFgAAMHmgww (envelope-from ); Fri, 17 Dec 2021 09:39:46 +0000 Subject: Re: [PATCH 1/1] multifd: Remove some redundant code To: Li Zhang , quintela@redhat.com, dgilbert@redhat.com, qemu-devel@nongnu.org References: <20211217093318.6260-1-lizhang@suse.de> From: Claudio Fontana Message-ID: <5ff179bb-cea8-35d9-f062-9cbfd3f7cb9e@suse.de> Date: Fri, 17 Dec 2021 10:39:45 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.12.0 MIME-Version: 1.0 In-Reply-To: <20211217093318.6260-1-lizhang@suse.de> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Received-SPF: pass client-ip=195.135.220.29; envelope-from=cfontana@suse.de; helo=smtp-out2.suse.de X-Spam_score_int: -60 X-Spam_score: -6.1 X-Spam_bar: ------ X-Spam_report: (-6.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, NICE_REPLY_A=-1.716, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Hi Li, the full function for context: static void multifd_new_send_channel_async(QIOTask *task, gpointer opaque) { MultiFDSendParams *p = opaque; QIOChannel *sioc = QIO_CHANNEL(qio_task_get_source(task)); Error *local_err = NULL; trace_multifd_new_send_channel_async(p->id); if (qio_task_propagate_error(task, &local_err)) { goto cleanup; } else { p->c = QIO_CHANNEL(sioc); qio_channel_set_delay(p->c, false); p->running = true; if (!multifd_channel_connect(p, sioc, local_err)) { goto cleanup; } return; } cleanup: multifd_new_send_channel_cleanup(p, sioc, local_err); } On 12/17/21 10:33 AM, Li Zhang wrote: > Clean up some unnecessary code > > Signed-off-by: Li Zhang > --- > migration/multifd.c | 9 ++------- > 1 file changed, 2 insertions(+), 7 deletions(-) > > diff --git a/migration/multifd.c b/migration/multifd.c > index 3242f688e5..1405cf95b8 100644 > --- a/migration/multifd.c > +++ b/migration/multifd.c > @@ -854,9 +854,7 @@ static void multifd_new_send_channel_async(QIOTask *task, gpointer opaque) > Error *local_err = NULL; > > trace_multifd_new_send_channel_async(p->id); > - if (qio_task_propagate_error(task, &local_err)) { > - goto cleanup; I see you are removing this goto, but keeping there the other one.. is this a bit inconsistent? Should the second check be inverted too, to remove the other goto as well? Ciao, Claudio > - } else { > + if (!qio_task_propagate_error(task, &local_err)) { > p->c = QIO_CHANNEL(sioc); > qio_channel_set_delay(p->c, false); > p->running = true; > @@ -1078,10 +1076,7 @@ static void *multifd_recv_thread(void *opaque) > > ret = qio_channel_read_all_eof(p->c, (void *)p->packet, > p->packet_len, &local_err); > - if (ret == 0) { /* EOF */ > - break; > - } > - if (ret == -1) { /* Error */ > + if (ret == 0 || ret == -1) { /* 0: EOF -1: Error */ > break; > } > >