summaryrefslogtreecommitdiffstats
path: root/fs/sysfs/file.c
diff options
context:
space:
mode:
authorTejun Heo <htejun@gmail.com>2007-07-18 16:38:11 +0900
committerGreg Kroah-Hartman <gregkh@suse.de>2007-07-18 15:49:50 -0700
commit967e35dcc9ac194b4a6fad69a5a51f93d69bb0d1 (patch)
tree218c6fc093ec110ee6f4c5d7f0aae448e5f82173 /fs/sysfs/file.c
parenta1da4dfe35bc36c3bc9716d995c85b7983c38a76 (diff)
sysfs: cosmetic clean up on node creation failure paths
Node addition failure is detected by testing return value of sysfs_addfm_finish() which returns the number of added and removed nodes. As the function is called as the last step of addition right on top of error handling block, the if blocks looked like the following. if (sysfs_addrm_finish(&acxt)) success handling, usually return; /* fall through to error handling */ This is the opposite of usual convention in sysfs and makes the code difficult to understand. This patch inverts the test and makes those blocks look more like others. Signed-off-by: Tejun Heo <htejun@gmail.com> Cc: Gabriel C <nix.or.die@googlemail.com> Cc: Miles Lane <miles.lane@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'fs/sysfs/file.c')
-rw-r--r--fs/sysfs/file.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/fs/sysfs/file.c b/fs/sysfs/file.c
index cc497994b2a..3e1cc062a74 100644
--- a/fs/sysfs/file.c
+++ b/fs/sysfs/file.c
@@ -410,11 +410,12 @@ int sysfs_add_file(struct sysfs_dirent *dir_sd, const struct attribute *attr,
sysfs_link_sibling(sd);
}
- if (sysfs_addrm_finish(&acxt))
- return 0;
+ if (!sysfs_addrm_finish(&acxt)) {
+ sysfs_put(sd);
+ return -EEXIST;
+ }
- sysfs_put(sd);
- return -EEXIST;
+ return 0;
}