mirror of
https://github.com/torvalds/linux.git
synced 2026-06-04 20:46:48 +02:00
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>
This commit is contained in:
parent
80b3695538
commit
2342d6595b
|
|
@ -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 ==
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user