From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54942) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VPa95-0006E0-7q for qemu-devel@nongnu.org; Fri, 27 Sep 2013 11:40:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VPa8y-0007Pb-Up for qemu-devel@nongnu.org; Fri, 27 Sep 2013 11:39:55 -0400 Received: from mx1.redhat.com ([209.132.183.28]:21084) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VPa8y-0007PL-Ml for qemu-devel@nongnu.org; Fri, 27 Sep 2013 11:39:48 -0400 From: Kevin Wolf Date: Fri, 27 Sep 2013 17:39:11 +0200 Message-Id: <1380296370-14523-12-git-send-email-kwolf@redhat.com> In-Reply-To: <1380296370-14523-1-git-send-email-kwolf@redhat.com> References: <1380296370-14523-1-git-send-email-kwolf@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PULL 11/30] block: Fix compiler warning (-Werror=uninitialized) List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: anthony@codemonkey.ws Cc: kwolf@redhat.com, qemu-devel@nongnu.org From: Stefan Weil The patch fixes a warning from gcc (Debian 4.6.3-14+rpi1) 4.6.3: block/stream.c:141:22: error: =E2=80=98copy=E2=80=99 may be used uninitialized in this function [-Werro= r=3Duninitialized] This is not a real bug - a better compiler would not complain. Now 'copy' has always a defined value, so the check for ret >=3D 0 can be removed. Signed-off-by: Stefan Weil Acked-by: Stefan Hajnoczi Signed-off-by: Kevin Wolf --- block/stream.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/block/stream.c b/block/stream.c index 078ce4a..45837f4 100644 --- a/block/stream.c +++ b/block/stream.c @@ -119,11 +119,12 @@ wait: break; } =20 + copy =3D false; + ret =3D bdrv_is_allocated(bs, sector_num, STREAM_BUFFER_SIZE / BDRV_SECTOR_SIZE, &= n); if (ret =3D=3D 1) { /* Allocated in the top, no need to copy. */ - copy =3D false; } else if (ret >=3D 0) { /* Copy if allocated in the intermediate images. Limit to t= he * known-unallocated area [sector_num, sector_num+n). */ @@ -138,7 +139,7 @@ wait: copy =3D (ret =3D=3D 1); } trace_stream_one_iteration(s, sector_num, n, ret); - if (ret >=3D 0 && copy) { + if (copy) { if (s->common.speed) { delay_ns =3D ratelimit_calculate_delay(&s->limit, n); if (delay_ns > 0) { --=20 1.8.1.4