From patchwork Tue Mar 30 09:23:25 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suresh Jayaraman X-Patchwork-Id: 48946 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.samba.org (fn.samba.org [216.83.154.106]) by ozlabs.org (Postfix) with ESMTP id 387F2B7C7E for ; Tue, 30 Mar 2010 20:23:53 +1100 (EST) Received: from fn.samba.org (localhost [127.0.0.1]) by lists.samba.org (Postfix) with ESMTP id 48883AD158; Tue, 30 Mar 2010 03:23:55 -0600 (MDT) X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on fn.samba.org X-Spam-Level: X-Spam-Status: No, score=-4.7 required=3.8 tests=AWL,BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.2.5 X-Original-To: linux-cifs-client@lists.samba.org Delivered-To: linux-cifs-client@lists.samba.org Received: from victor.provo.novell.com (victor.provo.novell.com [137.65.250.26]) by lists.samba.org (Postfix) with ESMTP id 764E0AC575 for ; Tue, 30 Mar 2010 03:23:49 -0600 (MDT) Received: from localhost (prv-ext-foundry1int.gns.novell.com [137.65.251.240]) by victor.provo.novell.com with ESMTP; Tue, 30 Mar 2010 03:23:28 -0600 From: Suresh Jayaraman To: Steve French Date: Tue, 30 Mar 2010 14:53:25 +0530 Message-Id: <1269941005-17159-1-git-send-email-sjayaraman@suse.de> X-Mailer: git-send-email 1.6.4.2 Cc: linux-cifs-client@lists.samba.org Subject: [linux-cifs-client] [PATCH] cifs: cleanup initialization of bytes_written X-BeenThere: linux-cifs-client@lists.samba.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: The Linux CIFS VFS client List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-cifs-client-bounces@lists.samba.org Errors-To: linux-cifs-client-bounces@lists.samba.org Initialize bytes_written at the callers uniformly so that CIFSSMBWrite2() and CIFSSMBWrite() do not have to worry about it. Signed-off-by: Suresh Jayaraman --- fs/cifs/cifssmb.c | 3 --- fs/cifs/dir.c | 2 +- fs/cifs/file.c | 2 +- fs/cifs/inode.c | 4 ++-- 4 files changed, 4 insertions(+), 7 deletions(-) diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c index 7cc7f83..bbf2afa 100644 --- a/fs/cifs/cifssmb.c +++ b/fs/cifs/cifssmb.c @@ -1512,7 +1512,6 @@ CIFSSMBWrite(const int xid, struct cifsTconInfo *tcon, cifs_stats_inc(&tcon->num_writes); if (rc) { cFYI(1, ("Send error in write = %d", rc)); - *nbytes = 0; } else { *nbytes = le16_to_cpu(pSMBr->CountHigh); *nbytes = (*nbytes) << 16; @@ -1539,8 +1538,6 @@ CIFSSMBWrite2(const int xid, struct cifsTconInfo *tcon, int smb_hdr_len; int resp_buf_type = 0; - *nbytes = 0; - cFYI(1, ("write2 at %lld %d bytes", (long long)offset, count)); if (tcon->ses->capabilities & CAP_LARGE_FILES) { diff --git a/fs/cifs/dir.c b/fs/cifs/dir.c index e9f7ecc..6d4e7e9 100644 --- a/fs/cifs/dir.c +++ b/fs/cifs/dir.c @@ -560,7 +560,7 @@ int cifs_mknod(struct inode *inode, struct dentry *direntry, int mode, /* BB Do not bother to decode buf since no local inode yet to put timestamps in, but we can reuse it safely */ - unsigned int bytes_written; + unsigned int bytes_written = 0; struct win_dev *pdev; pdev = (struct win_dev *)buf; if (S_ISCHR(mode)) { diff --git a/fs/cifs/file.c b/fs/cifs/file.c index ca2ba7a..6af4fbd 100644 --- a/fs/cifs/file.c +++ b/fs/cifs/file.c @@ -1341,7 +1341,7 @@ static int cifs_writepages(struct address_space *mapping, { struct backing_dev_info *bdi = mapping->backing_dev_info; unsigned int bytes_to_write; - unsigned int bytes_written; + unsigned int bytes_written = 0; struct cifs_sb_info *cifs_sb; int done = 0; pgoff_t end; diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c index 723daac..af0b0d4 100644 --- a/fs/cifs/inode.c +++ b/fs/cifs/inode.c @@ -1674,7 +1674,7 @@ cifs_set_file_size(struct inode *inode, struct iattr *attrs, cifsFileInfo_put(open_file); cFYI(1, ("SetFSize for attrs rc = %d", rc)); if ((rc == -EINVAL) || (rc == -EOPNOTSUPP)) { - unsigned int bytes_written; + unsigned int bytes_written = 0; rc = CIFSSMBWrite(xid, pTcon, nfid, 0, attrs->ia_size, &bytes_written, NULL, NULL, 1); cFYI(1, ("Wrt seteof rc %d", rc)); @@ -1703,7 +1703,7 @@ cifs_set_file_size(struct inode *inode, struct iattr *attrs, cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR); if (rc == 0) { - unsigned int bytes_written; + unsigned int bytes_written = 0; rc = CIFSSMBWrite(xid, pTcon, netfid, 0, attrs->ia_size, &bytes_written, NULL,