Skip to contentSkip to conversation

Fix missing braces in ncpfs:ncp_lookup

PATCH In review Dave Jones 3 participants 3 messages Sep 5, 2013

lore
Share & tools
lore

Dave Jones

author
#0 lore raw

PATCH 1/1 Fix missing braces in ncpfs:ncp_lookup

fs/ncpfs/dir.c +2 -1
index 3be0474..1f6419f 100644
@@ -857,10 +857,11 @@ static struct dentry *ncp_lookup(struct inode *dir, struct dentry *dentry, unsig
 	if (ncp_is_server_root(dir)) {
 		res = ncp_io2vol(server, __name, &len, dentry->d_name.name,
 				 dentry->d_name.len, 1);
-		if (!res)
+		if (!res) {
 			res = ncp_lookup_volume(server, __name, &(finfo.i));
 			if (!res)
 				ncp_update_known_namespace(server, finfo.i.volNumber, NULL);
+		}
 	} else {
 		res = ncp_io2vol(server, __name, &len, dentry->d_name.name,
 				 dentry->d_name.len, !ncp_preserve_case(dir));
#1 lore raw

(adding Petr Vandrovec to cc's)

fs/ncpfs/dir.c

Quoted 1 line
fs/ncpfs/dir.c +0 -0

[]

Quoted 10 lines
fs/ncpfs/dir.c +2 -1
@@ -857,10 +857,11 @@ static struct dentry *ncp_lookup(struct inode *dir, struct dentry *dentry, unsig
 	if (ncp_is_server_root(dir)) {
 		res = ncp_io2vol(server, __name, &len, dentry->d_name.name,
 				 dentry->d_name.len, 1);
-		if (!res)
+		if (!res) {
 			res = ncp_lookup_volume(server, __name, &(finfo.i));
 			if (!res)
 				ncp_update_known_namespace(server, finfo.i.volNumber, NULL);
+		}
#2 lore raw
In reply to Dave Jones
Quoted 7 lines · Dave Jones
fs/ncpfs/dir.c +0 -0
index 3be0474..1f6419f 100644

fs/ncpfs/dir.c static struct dentry *ncp_lookup(struct inode *dir, struct dentry *dentry, unsig · line 864

Quoted 9 lines
fs/ncpfs/dir.c +2 -1
@@ -857,10 +857,11 @@ static struct dentry *ncp_lookup(struct inode *dir, struct dentry *dentry, unsig
 	if (ncp_is_server_root(dir)) {
 		res = ncp_io2vol(server, __name, &len, dentry->d_name.name,
 				 dentry->d_name.len, 1);
-		if (!res)
+		if (!res) {
 			res = ncp_lookup_volume(server, __name, &(finfo.i));
 			if (!res)
 				ncp_update_known_namespace(server, finfo.i.volNumber, NULL);
+		}

That, or shift two lines one indent level out ;-) I mean,

	if (!foo)
		foo = bar();
	if (!foo)
		baz();
is provably equivalent to
	if (!foo) {
		foo = bar();
		if (!foo)
			baz();
	}

I agree that the current form shouldn't be left as-is - the kernel isn't IOCCC and all such. The only question is which variant would read better...