[PATCH] filesystems: Simplify if conditional statements

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



When the * p pointer is null, assign a value to res; otherwise, do not
execute the content in the conditional statement block.

Signed-off-by: Li zeming <zeming@xxxxxxxxxxxx>
---
 fs/filesystems.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/fs/filesystems.c b/fs/filesystems.c
index 58b9067b2391..1839dcd6cfbd 100644
--- a/fs/filesystems.c
+++ b/fs/filesystems.c
@@ -71,7 +71,7 @@ static struct file_system_type **find_filesystem(const char *name, unsigned len)
  
 int register_filesystem(struct file_system_type * fs)
 {
-	int res = 0;
+	int res = -EBUSY;
 	struct file_system_type ** p;
 
 	if (fs->parameters &&
@@ -83,10 +83,10 @@ int register_filesystem(struct file_system_type * fs)
 		return -EBUSY;
 	write_lock(&file_systems_lock);
 	p = find_filesystem(fs->name, strlen(fs->name));
-	if (*p)
-		res = -EBUSY;
-	else
+	if (!*p) {
+		res = 0;
 		*p = fs;
+	}
 	write_unlock(&file_systems_lock);
 	return res;
 }
-- 
2.18.2




[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux