qemu-block
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH v1 1/1] block/file-posix: Avoid maybe-uninitialized warning


From: Edgar E. Iglesias
Subject: [PATCH v1 1/1] block/file-posix: Avoid maybe-uninitialized warning
Date: Mon, 12 Aug 2024 16:43:23 +0200

From: "Edgar E. Iglesias" <edgar.iglesias@amd.com>

Avoid a maybe-uninitialized warning in raw_refresh_zoned_limits()
by initializing zoned.

With GCC 14.1.0:
In function ‘raw_refresh_zoned_limits’,
    inlined from ‘raw_refresh_limits’ at ../qemu/block/file-posix.c:1522:5:
../qemu/block/file-posix.c:1405:17: error: ‘zoned’ may be used uninitialized 
[-Werror=maybe-uninitialized]
 1405 |     if (ret < 0 || zoned == BLK_Z_NONE) {
      |         ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
../qemu/block/file-posix.c:1401:20: note: ‘zoned’ was declared here
 1401 |     BlockZoneModel zoned;
      |                    ^~~~~
cc1: all warnings being treated as errors

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@amd.com>
---
 block/file-posix.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/block/file-posix.c b/block/file-posix.c
index ff928b5e85..90fa54352c 100644
--- a/block/file-posix.c
+++ b/block/file-posix.c
@@ -1398,7 +1398,7 @@ static void raw_refresh_zoned_limits(BlockDriverState 
*bs, struct stat *st,
                                      Error **errp)
 {
     BDRVRawState *s = bs->opaque;
-    BlockZoneModel zoned;
+    BlockZoneModel zoned = BLK_Z_NONE;
     int ret;
 
     ret = get_sysfs_zoned_model(st, &zoned);
-- 
2.43.0




reply via email to

[Prev in Thread] Current Thread [Next in Thread]