]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
btrfs: fix uninitialized variable warning in run_one_async_start
authorJosef Bacik <josef@toxicpanda.com>
Fri, 16 Dec 2022 20:15:51 +0000 (15:15 -0500)
committerDavid Sterba <dsterba@suse.com>
Mon, 13 Feb 2023 16:50:33 +0000 (17:50 +0100)
With -Wmaybe-uninitialized compiler complains about ret being possibly
uninitialized, which isn't possible as the WQ_ constants are set only
from our code, however we can handle the default case and get rid of the
warning.

The value is set to BLK_STS_IOERR so it does not issue any IO and could
be potentially detected, but this is basically a "cannot happen" error.
To catch any problems during development use the assert.

Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Reviewed-by: David Sterba <dsterba@suse.com>
[ set the error in default: ]
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/disk-io.c

index 3aa04224315eb383f3b61d8a278b02e68e01bb56..7586a8e9b718925a290fcf2c65f6af9bd228b087 100644 (file)
@@ -717,6 +717,10 @@ static void run_one_async_start(struct btrfs_work *work)
                ret = btrfs_submit_bio_start_direct_io(async->inode,
                                async->bio, async->dio_file_offset);
                break;
+       default:
+               /* Can't happen so return something that would prevent the IO. */
+               ret = BLK_STS_IOERR;
+               ASSERT(0);
        }
        if (ret)
                async->status = ret;