From: Wei Yongjun Date: Fri, 22 Feb 2013 00:42:43 +0000 (-0800) Subject: configfs: move the dereference below the NULL test X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=49deb4bc227cb9db5b8ebf9434367f8bed057c7a;p=GitHub%2FLineageOS%2Fandroid_kernel_samsung_universal7580.git configfs: move the dereference below the NULL test The dereference should be moved below the NULL test. spatch with a semantic match is used to found this. (http://coccinelle.lip6.fr/) Signed-off-by: Wei Yongjun Cc: Joel Becker Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/fs/configfs/dir.c b/fs/configfs/dir.c index 712b10f64c7..e9dcfa3c208 100644 --- a/fs/configfs/dir.c +++ b/fs/configfs/dir.c @@ -1037,10 +1037,11 @@ static int configfs_dump(struct configfs_dirent *sd, int level) static int configfs_depend_prep(struct dentry *origin, struct config_item *target) { - struct configfs_dirent *child_sd, *sd = origin->d_fsdata; + struct configfs_dirent *child_sd, *sd; int ret = 0; - BUG_ON(!origin || !sd); + BUG_ON(!origin || !origin->d_fsdata); + sd = origin->d_fsdata; if (sd->s_element == target) /* Boo-yah */ goto out;