[PATCH][4/6] cifs: readdir.c cleanup - kfree() changes

From: Jesper Juhl
Date: Tue Mar 22 2005 - 15:31:12 EST



This patch removes redundant NULL pointer checks before calling kfree().


Signed-off-by: Jesper Juhl <juhl-lkml@xxxxxx>

--- linux-2.6.12-rc1-mm1/fs/cifs/readdir.c.with_patch3 2005-03-22 20:14:37.000000000 +0100
+++ linux-2.6.12-rc1-mm1/fs/cifs/readdir.c 2005-03-22 20:15:40.000000000 +0100
@@ -330,8 +330,7 @@ static int initiate_cifs_search(const in
&cifsFile->netfid, &cifsFile->srch_inf);
if (rc == 0)
cifsFile->invalidHandle = FALSE;
- if (full_path)
- kfree(full_path);
+ kfree(full_path);
return rc;
}

@@ -471,10 +470,8 @@ static int find_cifs_entry(const int xid
cFYI(1, ("search backing up - close and restart search"));
cifsFile->invalidHandle = TRUE;
CIFSFindClose(xid, pTcon, cifsFile->netfid);
- if (cifsFile->search_resume_name) {
- kfree(cifsFile->search_resume_name);
- cifsFile->search_resume_name = NULL;
- }
+ kfree(cifsFile->search_resume_name);
+ cifsFile->search_resume_name = NULL;
if (cifsFile->srch_inf.ntwrk_buf_start) {
cFYI(1, ("freeing SMB ff cache buf on search rewind"));
cifs_buf_release(cifsFile->srch_inf.ntwrk_buf_start);
@@ -813,10 +810,8 @@ int cifs_readdir(struct file *file, void
cifsFile->invalidHandle = TRUE;
CIFSFindClose(xid, pTcon, cifsFile->netfid);
}
- if (cifsFile->search_resume_name) {
- kfree(cifsFile->search_resume_name);
- cifsFile->search_resume_name = NULL;
- } */
+ kfree(cifsFile->search_resume_name);
+ cifsFile->search_resume_name = NULL; */
/* BB account for . and .. in f_pos */
/* dump_cifs_file_struct(file, "rdir after default "); */

@@ -866,8 +861,7 @@ int cifs_readdir(struct file *file, void
current_entry = nxt_dir_entry(current_entry,
end_of_smb);
}
- if (tmp_buf != NULL)
- kfree(tmp_buf);
+ kfree(tmp_buf);
break;
} /* end switch */
rddir2_exit:



-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/