summaryrefslogtreecommitdiffstats
path: root/fs/btrfs
diff options
context:
space:
mode:
authorFilipe Manana <fdmanana@suse.com>2024-11-06 13:14:09 +0100
committerDavid Sterba <dsterba@suse.com>2024-11-11 14:34:22 +0100
commit2342d6595b608eec94187a17dc112dd4c2a812fa (patch)
treefc6e8d3d6ec113a06cd914c55162efd1dd74fbd1 /fs/btrfs
parentbtrfs: fix a typo in btrfs_use_zone_append (diff)
downloadlinux-2342d6595b608eec94187a17dc112dd4c2a812fa.tar.xz
linux-2342d6595b608eec94187a17dc112dd4c2a812fa.zip
btrfs: fix warning on PTR_ERR() against NULL device at btrfs_control_ioctl()
Smatch complains about calling PTR_ERR() against a NULL pointer: fs/btrfs/super.c:2272 btrfs_control_ioctl() warn: passing zero to 'PTR_ERR' Fix this by calling PTR_ERR() against the device pointer only if it contains an error. Reviewed-by: Qu Wenruo <wqu@suse.com> Signed-off-by: Filipe Manana <fdmanana@suse.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs')
-rw-r--r--fs/btrfs/super.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
index 7cd62307cd41..3381389ab93a 100644
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@ -2254,7 +2254,10 @@ static long btrfs_control_ioctl(struct file *file, unsigned int cmd,
device = btrfs_scan_one_device(vol->name, BLK_OPEN_READ, false);
if (IS_ERR_OR_NULL(device)) {
mutex_unlock(&uuid_mutex);
- ret = PTR_ERR(device);
+ if (IS_ERR(device))
+ ret = PTR_ERR(device);
+ else
+ ret = 0;
break;
}
ret = !(device->fs_devices->num_devices ==