From: Xichao Zhao Date: Tue, 12 Aug 2025 08:25:54 +0000 (+0800) Subject: btrfs: use PTR_ERR_OR_ZERO() to simplify code inbtrfs_control_ioctl() X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=28a38e20acf58ddbeb65eb1c359cc43414094f5a;p=users%2Fhch%2Fmisc.git btrfs: use PTR_ERR_OR_ZERO() to simplify code inbtrfs_control_ioctl() Use the standard error pointer macro to simplify the code. Reviewed-by: Daniel Vacek Signed-off-by: Xichao Zhao Reviewed-by: David Sterba Signed-off-by: David Sterba --- diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c index b06b8f325537..ee2418bb2efd 100644 --- a/fs/btrfs/super.c +++ b/fs/btrfs/super.c @@ -2274,10 +2274,7 @@ static long btrfs_control_ioctl(struct file *file, unsigned int cmd, device = btrfs_scan_one_device(vol->name, false); if (IS_ERR_OR_NULL(device)) { mutex_unlock(&uuid_mutex); - if (IS_ERR(device)) - ret = PTR_ERR(device); - else - ret = 0; + ret = PTR_ERR_OR_ZERO(device); break; } ret = !(device->fs_devices->num_devices ==