Commit 49deb4bc authored by Wei Yongjun's avatar Wei Yongjun Committed by Linus Torvalds

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: default avatarWei Yongjun <yongjun_wei@trendmicro.com.cn>
Cc: Joel Becker <jlbec@evilplan.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 1b2643f0
...@@ -1037,10 +1037,11 @@ static int configfs_dump(struct configfs_dirent *sd, int level) ...@@ -1037,10 +1037,11 @@ static int configfs_dump(struct configfs_dirent *sd, int level)
static int configfs_depend_prep(struct dentry *origin, static int configfs_depend_prep(struct dentry *origin,
struct config_item *target) struct config_item *target)
{ {
struct configfs_dirent *child_sd, *sd = origin->d_fsdata; struct configfs_dirent *child_sd, *sd;
int ret = 0; int ret = 0;
BUG_ON(!origin || !sd); BUG_ON(!origin || !origin->d_fsdata);
sd = origin->d_fsdata;
if (sd->s_element == target) /* Boo-yah */ if (sd->s_element == target) /* Boo-yah */
goto out; goto out;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment