From 593d02f2245d941f2ea0ac847aa2de215c83187e Mon Sep 17 00:00:00 2001 From: Arshad Hussain Date: Sat, 27 Jun 2020 17:55:18 +0530 Subject: [PATCH] LU-13723 lustre: Convert ERR_PTR(PTR_ERR()) to ERR_CAST() This patch converts ERR_PTR(PTR_ERR()) to ERR_CAST() This fixes warning thrown by coccinelle It also updates contrib/scripts/spelling.txt to catch any future misuse of ERR_PTR(PTR_ERR()) Test-Parameters: trivial Signed-off-by: Arshad Hussain Change-Id: I2214f46c08e5295dd139e7b4b245881cd9f6495a Reviewed-on: https://review.whamcloud.com/39204 Reviewed-by: Andreas Dilger Tested-by: jenkins Tested-by: Maloo Reviewed-by: James Simmons Reviewed-by: Ben Evans Reviewed-by: Petros Koutoupis Reviewed-by: Oleg Drokin --- contrib/scripts/spelling.txt | 1 + lustre/llite/llite_nfs.c | 2 +- lustre/lod/lod_qos.c | 2 +- lustre/mdd/mdd_device.c | 2 +- lustre/obdclass/dt_object.c | 2 +- lustre/obdclass/local_storage.c | 4 ++-- 6 files changed, 7 insertions(+), 6 deletions(-) diff --git a/contrib/scripts/spelling.txt b/contrib/scripts/spelling.txt index e678613..ee44b46 100644 --- a/contrib/scripts/spelling.txt +++ b/contrib/scripts/spelling.txt @@ -103,6 +103,7 @@ DEFINE_TIMER||CFS_DEFINE_TIMER container_of0||container_of_safe DN_MAX_BONUSLEN||DN_BONUS_SIZE(dnodesize) DN_OLD_MAX_BONUSLEN||DN_BONUS_SIZE(DNODE_MIN_SIZE) +ERR_PTR.PTR_ERR||ERR_CAST from_timer||cfs_from_timer f_dentry||f_path.dentry [^_]get_seconds||ktime_get_real_seconds diff --git a/lustre/llite/llite_nfs.c b/lustre/llite/llite_nfs.c index c51f5ef..7fef62a 100644 --- a/lustre/llite/llite_nfs.c +++ b/lustre/llite/llite_nfs.c @@ -127,7 +127,7 @@ ll_iget_for_nfs(struct super_block *sb, struct lu_fid *fid, struct lu_fid *paren inode = search_inode_for_lustre(sb, fid); if (IS_ERR(inode)) - RETURN(ERR_PTR(PTR_ERR(inode))); + RETURN(ERR_CAST(inode)); if (is_bad_inode(inode)) { /* we didn't find the right inode.. */ diff --git a/lustre/lod/lod_qos.c b/lustre/lod/lod_qos.c index 7fe0826..eefc286 100644 --- a/lustre/lod/lod_qos.c +++ b/lustre/lod/lod_qos.c @@ -387,7 +387,7 @@ static struct dt_object *lod_qos_declare_object_on(const struct lu_env *env, */ o = lu_object_anon(env, nd, NULL); if (IS_ERR(o)) - GOTO(out, dt = ERR_PTR(PTR_ERR(o))); + GOTO(out, dt = ERR_CAST(o)); n = lu_object_locate(o->lo_header, nd->ld_type); if (unlikely(n == NULL)) { diff --git a/lustre/mdd/mdd_device.c b/lustre/mdd/mdd_device.c index a3f53e4..cd03553 100644 --- a/lustre/mdd/mdd_device.c +++ b/lustre/mdd/mdd_device.c @@ -872,7 +872,7 @@ static struct md_object *mdo_locate(const struct lu_env *env, LASSERT(obj != NULL); mdo = lu2md(obj); } else { - mdo = ERR_PTR(PTR_ERR(obj)); + mdo = ERR_CAST(obj); } return mdo; } diff --git a/lustre/obdclass/dt_object.c b/lustre/obdclass/dt_object.c index d334398..e14f216 100644 --- a/lustre/obdclass/dt_object.c +++ b/lustre/obdclass/dt_object.c @@ -234,7 +234,7 @@ struct dt_object *dt_locate_at(const struct lu_env *env, lo = lu_object_find_at(env, top_dev, fid, conf); if (IS_ERR(lo)) - return ERR_PTR(PTR_ERR(lo)); + return ERR_CAST(lo); LASSERT(lo != NULL); diff --git a/lustre/obdclass/local_storage.c b/lustre/obdclass/local_storage.c index cc3b0de..05132b0 100644 --- a/lustre/obdclass/local_storage.c +++ b/lustre/obdclass/local_storage.c @@ -503,7 +503,7 @@ struct dt_object *local_file_find_or_create_with_fid(const struct lu_env *env, ls = ls_device_get(dt); if (IS_ERR(ls)) { - dto = ERR_PTR(PTR_ERR(ls)); + dto = ERR_CAST(ls); } else { /* create the object */ dti->dti_attr.la_valid = LA_MODE; @@ -598,7 +598,7 @@ local_index_find_or_create_with_fid(const struct lu_env *env, ls = ls_device_get(dt); if (IS_ERR(ls)) { - dto = ERR_PTR(PTR_ERR(ls)); + dto = ERR_CAST(ls); } else { /* create the object */ dti->dti_attr.la_valid = LA_MODE; -- 1.8.3.1