Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1j6u3B-0000CV-W9 for mharc-qemu-trivial@gnu.org; Wed, 26 Feb 2020 05:36:22 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:57810) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j6u39-0000Az-Dq for qemu-trivial@nongnu.org; Wed, 26 Feb 2020 05:36:20 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j6u38-0002Ab-91 for qemu-trivial@nongnu.org; Wed, 26 Feb 2020 05:36:19 -0500 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:37046 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1j6u38-000291-5J for qemu-trivial@nongnu.org; Wed, 26 Feb 2020 05:36:18 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1582713376; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ODLEvxrJOLvP0jliU5YyCcs7Etg2vs0tTEaqV0F4UJk=; b=VD9KGIdMDtA+sEpvviyLz0AAMDLJ8I2iblrKMUOiEWlakFYJjxMhvGgb793jkyKFqztXW0 B62ttVZ8t7x7EpetlbNRVFccSYxyBlEIy1fNb0K3/nnC8rbokClSdp8eoSBSP8KLa+lKyO bly+YkvkW6YaRTkOeEUfxDqDxXMQZzg= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-405-jtTEHQgoOwa87HA6dTQocw-1; Wed, 26 Feb 2020 05:36:13 -0500 X-MC-Unique: jtTEHQgoOwa87HA6dTQocw-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B27BE2F60; Wed, 26 Feb 2020 10:36:11 +0000 (UTC) Received: from linux.fritz.box (ovpn-117-170.ams2.redhat.com [10.36.117.170]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 08ACA60BE2; Wed, 26 Feb 2020 10:36:09 +0000 (UTC) Date: Wed, 26 Feb 2020 11:36:08 +0100 From: Kevin Wolf To: "Chenqun (kuhn)" Cc: John Snow , "qemu-devel@nongnu.org" , "qemu-trivial@nongnu.org" , "peter.maydell@linaro.org" , Zhanghailiang , Euler Robot , Max Reitz Subject: Re: [PATCH v2 01/13] block/stream: Remove redundant statement in stream_run() Message-ID: <20200226103608.GC6096@linux.fritz.box> References: <20200226084647.20636-1-kuhn.chenqun@huawei.com> <20200226084647.20636-2-kuhn.chenqun@huawei.com> <20200226095102.GA6096@linux.fritz.box> <7412CDE03601674DA8197E2EBD8937E83B662BBF@dggemm531-mbx.china.huawei.com> MIME-Version: 1.0 In-Reply-To: <7412CDE03601674DA8197E2EBD8937E83B662BBF@dggemm531-mbx.china.huawei.com> User-Agent: Mutt/1.12.1 (2019-06-15) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 207.211.31.120 X-BeenThere: qemu-trivial@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Feb 2020 10:36:20 -0000 Am 26.02.2020 um 11:21 hat Chenqun (kuhn) geschrieben: >=20 >=20 > >-----Original Message----- > >From: Kevin Wolf [mailto:kwolf@redhat.com] > >Sent: Wednesday, February 26, 2020 5:51 PM > >To: Chenqun (kuhn) > >Cc: qemu-devel@nongnu.org; qemu-trivial@nongnu.org; > >peter.maydell@linaro.org; Zhanghailiang = ; > >Euler Robot ; John Snow ; > >Max Reitz > >Subject: Re: [PATCH v2 01/13] block/stream: Remove redundant statement i= n > >stream_run() > > > >Am 26.02.2020 um 09:46 hat kuhn.chenqun@huawei.com geschrieben: > >> From: Chen Qun > >> > >> Clang static code analyzer show warning: > >> block/stream.c:186:9: warning: Value stored to 'ret' is never read > >> ret =3D 0; > >> ^ ~ > >> Reported-by: Euler Robot > >> Signed-off-by: Chen Qun > >> Reviewed-by: John Snow > > > >Let's mention that this is unnecessary since commit 1d809098aa9. > > > >Since the same commit, the initialisation 'int ret =3D 0;' is unnecessar= y because > >we never read ret before overwriting the initial value. We could clean t= his up > >in the same patch. >=20 > Yes, we can clean it and move 'ret' declaration to the for() statement. >=20 > Modify just Like this=EF=BC=9A > [...] Godd point, makes sense to me. Please keep my R-b if you make this change. Kevin > @@ -114,7 +114,6 @@ static int coroutine_fn stream_run(Job *job, Error **= errp) > int64_t offset =3D 0; > uint64_t delay_ns =3D 0; > int error =3D 0; > - int ret =3D 0; > int64_t n =3D 0; /* bytes */ >=20 > if (bs =3D=3D s->bottom) { > @@ -139,6 +138,7 @@ static int coroutine_fn stream_run(Job *job, Error **= errp) >=20 > for ( ; offset < len; offset +=3D n) { > bool copy; > + int ret; >=20 > /* Note that even when no rate limit is applied we need to yield > * with no pending I/O here so that bdrv_drain_all() returns. > @@ -183,7 +183,6 @@ static int coroutine_fn stream_run(Job *job, Error **= errp) > break; > } > } > - ret =3D 0; >=20 > /* Publish progress */ > job_progress_update(&s->common.job, n); >=20 > > > >With or without the changes: > > > >Reviewed-by: Kevin Wolf >=20