From: Bob Glossman Date: Sun, 18 Sep 2016 20:38:25 +0000 (-0400) Subject: staging: lustre: obdclass: eliminate NULL error return X-Git-Tag: v4.9-rc1~119^2~418 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=a21e4b903d8ce19831dd504d8bfc4c99e85c2624;p=karo-tx-linux.git staging: lustre: obdclass: eliminate NULL error return Always return an ERR_PTR() on errors, never return a NULL, in lu_object_find_slice(). Also clean up callers who no longer need special case handling of NULL returns. Signed-off-by: Bob Glossman Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-5858 Reviewed-on: http://review.whamcloud.com/12554 Reviewed-by: Dmitry Eremin Reviewed-by: Fan Yong Reviewed-by: John L. Hammond Reviewed-by: Oleg Drokin Signed-off-by: James Simmons Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/lustre/lustre/obdclass/lu_object.c b/drivers/staging/lustre/lustre/obdclass/lu_object.c index 7339c8b2bee7..3f1fb285aecb 100644 --- a/drivers/staging/lustre/lustre/obdclass/lu_object.c +++ b/drivers/staging/lustre/lustre/obdclass/lu_object.c @@ -767,13 +767,15 @@ struct lu_object *lu_object_find_slice(const struct lu_env *env, struct lu_object *obj; top = lu_object_find(env, dev, f, conf); - if (!IS_ERR(top)) { - obj = lu_object_locate(top->lo_header, dev->ld_type); - if (!obj) - lu_object_put(env, top); - } else { - obj = top; + if (IS_ERR(top)) + return top; + + obj = lu_object_locate(top->lo_header, dev->ld_type); + if (unlikely(!obj)) { + lu_object_put(env, top); + obj = ERR_PTR(-ENOENT); } + return obj; } EXPORT_SYMBOL(lu_object_find_slice);