[PATCH] xfs: fix err_cast.cocci warnings

From: kernel test robot
Date: Thu Oct 28 2021 - 16:52:53 EST


From: kernel test robot <lkp@xxxxxxxxx>

fs/xfs/scrub/xfbtree.c:234:9-16: WARNING: ERR_CAST can be used with xfbt -> xfile


Use ERR_CAST inlined function instead of ERR_PTR(PTR_ERR(...))

Generated by: scripts/coccinelle/api/err_cast.cocci

Fixes: f47d10306ea7 ("xfs: connect in-memory btrees to xfiles")
Reported-by: kernel test robot <lkp@xxxxxxxxx>
Signed-off-by: kernel test robot <lkp@xxxxxxxxx>
---

tree: https://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfs-linux.git repair-rmap-live
head: 058725b83f3ab866a225aec3bfa204c0b7f4d3a8
commit: f47d10306ea759e3e0749de65cdd1680383be13f [326/331] xfs: connect in-memory btrees to xfiles
:::::: branch date: 6 days ago
:::::: commit date: 6 days ago

xfbtree.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

--- a/fs/xfs/scrub/xfbtree.c
+++ b/fs/xfs/scrub/xfbtree.c
@@ -231,7 +231,7 @@ xfbtree_create(

xfbt->xfile = xfile_create(description, 0);
if (IS_ERR(xfbt->xfile))
- return ERR_PTR(PTR_ERR(xfbt->xfile));
+ return ERR_CAST(xfbt->xfile);

xfbt->target = xfs_alloc_memory_buftarg(mp, xfbt->xfile);
if (!xfbt->target) {