[PATCH] btrfs: use PTR_ERR_OR_ZERO() to simplify code
From: Xichao Zhao
Date: Tue Aug 12 2025 - 04:27:03 EST
Use the standard error pointer macro to shorten the code and simplify.
Signed-off-by: Xichao Zhao <zhao.xichao@xxxxxxxx>
---
fs/btrfs/super.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
index 68e35a3700ff..57dd58fd8b9c 100644
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@ -2257,10 +2257,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 ==
--
2.34.1