fs/btrfs/super.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
Use the standard error pointer macro to shorten the code and simplify.
Signed-off-by: Xichao Zhao <zhao.xichao@vivo.com>
---
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
On Tue, Aug 12, 2025 at 04:25:54PM +0800, Xichao Zhao wrote: > Use the standard error pointer macro to shorten the code and simplify. > > Signed-off-by: Xichao Zhao <zhao.xichao@vivo.com> Added to for-next, thanks.
On Tue, 12 Aug 2025 at 10:27, Xichao Zhao <zhao.xichao@vivo.com> wrote:
>
> Use the standard error pointer macro to shorten the code and simplify.
>
> Signed-off-by: Xichao Zhao <zhao.xichao@vivo.com>
> ---
> 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);
LGTM.
Reviewed-by: Daniel Vacek <neelx@suse.com>
> break;
> }
> ret = !(device->fs_devices->num_devices ==
> --
> 2.34.1
>
>
© 2016 - 2026 Red Hat, Inc.