[patch 3/3] get rid of two unnessesary assignments in fs/cifs/file.c

Steven French sfrench at us.ibm.com
Wed Jan 5 17:09:23 GMT 2005

The reason for the logic:

        rc = -EIO;
        return rc;

rather than
        return -EIO;

is mainly to simplify debugging.  When debugging is enabled at runtime 
(e.g. "echo 1 > /proc/fs/cifs/cifsFYI"), FreeXid will print the value of 
rc to dmesg as an informational message which helps in debugging.  In 
addition the FreeXid macro can be modified fairly easily when 
investigating problems to selectively take certain additional debug 
actions based on the rc. 

If there is a better way to globally turn on debugging to catch the rc of 
the main functions (ie what I consider the principal entry points to the 
module rather than all worker functions) without cluttering the error log 
with rc of all of the functions, I don't mind getting rid of the optional 
printk in FreeXid.

Steve French
Senior Software Engineer
Linux Technology Center - IBM Austin
phone: 512-838-2294
email: sfrench at-sign us dot ibm dot com

Jesper Juhl <juhl-lkml at dif.dk> 
12/28/2004 05:55 PM

Alan Cox <alan at lxorguk.ukuu.org.uk>
Jesper Juhl <juhl-lkml at dif.dk>, Steve French <sfrench at samba.org>, Steven 
French/Austin/IBM at IBMUS, samba-technical 
<samba-technical at lists.samba.org>, Jörn Engel 
<joern at wohnheim.fh-wedel.de>, Linux Kernel Mailing List 
<linux-kernel at vger.kernel.org>
Re: [patch 3/3] get rid of two unnessesary assignments in fs/cifs/file.c

in two places in fs/cifs/file.c we assign -EIO to a variable (rc) then 
do something unrelated to rc, then return rc. The assignment of -EIO to rc 

is unnessesary, we may as well just return -EIO directly and avoid the 
extra assignment (yeah, the compiler will probably optimize it, but 

Signed-off-by: Jesper Juhl <juhl-lkml at dif.dk>

diff -up linux-2.6.10/fs/cifs/file.c~ linux-2.6.10/fs/cifs/file.c
--- linux-2.6.10/fs/cifs/file.c~                 2004-12-29 
00:41:00.000000000 +0100
+++ linux-2.6.10/fs/cifs/file.c          2004-12-29 00:40:51.000000000 
@@ -1947,17 +1947,15 @@ cifs_readdir(struct file *file, void *di
                 xid = GetXid();
                 if (file->f_dentry == NULL) {
-                                rc = -EIO;
-                                return rc;
+                                return -EIO;
                 cifs_sb = CIFS_SB(file->f_dentry->d_sb);
                 pTcon = cifs_sb->tcon;
                 bufsize = pTcon->ses->server->maxBuf - MAX_CIFS_HDR_SIZE;
                 if (bufsize > CIFSMaxBufSize) {
-                                rc = -EIO;
-                                return rc;
+                                return -EIO;
                 data = kmalloc(bufsize, GFP_KERNEL);
                 pfindData = (FILE_DIRECTORY_INFO *)data;

More information about the samba-technical mailing list