Received: from eggs.gnu.org ([2001:4830:134:3::10]:36334) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VNd0o-0003fF-RN for qemu-devel@nongnu.org; Sun, 22 Sep 2013 02:19:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VNd0j-0005EN-UU for qemu-devel@nongnu.org; Sun, 22 Sep 2013 02:19:18 -0400 From: Stefan Weil Date: Sun, 22 Sep 2013 08:19:10 +0200 Message-Id: <1379830750-23801-1-git-send-email-sw@weilnetz.de> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PATCH v2] block: Fix compiler warning (-Werror=uninitialized) List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel Cc: qemu-trivial , Kevin Wolf , =?UTF-8?q?Andreas=20F=C3=A4rber?= , Stefan Hajnoczi , 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 --- v2: As noted by Andreas F=C3=A4rber, 'copy' must be set to false after the go= to label. Thanks for this hint. Regards, Stefan 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.7.10.4