Whamcloud - gitweb
LU-13723 lustre: Convert ERR_PTR(PTR_ERR()) to ERR_CAST() 04/39204/3
authorArshad Hussain <arshad.super@gmail.com>
Sat, 27 Jun 2020 12:25:18 +0000 (17:55 +0530)
committerOleg Drokin <green@whamcloud.com>
Sat, 4 Jul 2020 03:05:57 +0000 (03:05 +0000)
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 <arshad.super@gmail.com>
Change-Id: I2214f46c08e5295dd139e7b4b245881cd9f6495a
Reviewed-on: https://review.whamcloud.com/39204
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Ben Evans <beevans@whamcloud.com>
Reviewed-by: Petros Koutoupis <petros.koutoupis@hpe.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
contrib/scripts/spelling.txt
lustre/llite/llite_nfs.c
lustre/lod/lod_qos.c
lustre/mdd/mdd_device.c
lustre/obdclass/dt_object.c
lustre/obdclass/local_storage.c

index e678613..ee44b46 100644 (file)
@@ -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
index c51f5ef..7fef62a 100644 (file)
@@ -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.. */
index 7fe0826..eefc286 100644 (file)
@@ -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)) {
index a3f53e4..cd03553 100644 (file)
@@ -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;
 }
index d334398..e14f216 100644 (file)
@@ -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);
 
index cc3b0de..05132b0 100644 (file)
@@ -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;