From: Leon Romanovsky Date: Wed, 19 Aug 2020 14:16:28 +0000 (+0300) Subject: btrfs: sysfs: fix unused-but-set-variable warnings X-Git-Tag: v5.10.7~1090^2~148 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=24646481fb19a3bd86933ec30480454381ff9860;p=platform%2Fkernel%2Flinux-rpi.git btrfs: sysfs: fix unused-but-set-variable warnings The compilation with W=1 generates the following warnings: fs/btrfs/sysfs.c:1630:6: warning: variable 'ret' set but not used [-Wunused-but-set-variable] 1630 | int ret; | ^~~ fs/btrfs/sysfs.c:1629:6: warning: variable 'features' set but not used [-Wunused-but-set-variable] 1629 | u64 features; | ^~~~~~~~ [ The unused variables are leftover from e410e34fad91 ("Revert "btrfs: synchronize incompat feature bits with sysfs files""), which needs to be properly fixed by moving feature bit manipulation from the sysfs context. Silence the warning to save pepople time, we got several reports. ] Signed-off-by: Leon Romanovsky Reviewed-by: David Sterba Signed-off-by: David Sterba --- diff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c index fcc8757..81496ac 100644 --- a/fs/btrfs/sysfs.c +++ b/fs/btrfs/sysfs.c @@ -1630,12 +1630,16 @@ void btrfs_sysfs_feature_update(struct btrfs_fs_info *fs_info, { struct btrfs_fs_devices *fs_devs; struct kobject *fsid_kobj; - u64 features; - int ret; + u64 __maybe_unused features; + int __maybe_unused ret; if (!fs_info) return; + /* + * See 14e46e04958df74 and e410e34fad913dd, feature bit updates are not + * safe when called from some contexts (eg. balance) + */ features = get_features(fs_info, set); ASSERT(bit & supported_feature_masks[set]);