Linux-CIFS Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH -next] cifs: remove set but not used variables
@ 2019-08-23 12:15 YueHaibing
  2019-08-26  0:47 ` Steve French
  0 siblings, 1 reply; 2+ messages in thread
From: YueHaibing @ 2019-08-23 12:15 UTC (permalink / raw)
  To: sfrench; +Cc: linux-cifs, samba-technical, linux-kernel, YueHaibing

Fixes gcc '-Wunused-but-set-variable' warning:

fs/cifs/file.c: In function cifs_lock:
fs/cifs/file.c:1696:24: warning: variable cinode set but not used [-Wunused-but-set-variable]
fs/cifs/file.c: In function cifs_write:
fs/cifs/file.c:1765:23: warning: variable cifs_sb set but not used [-Wunused-but-set-variable]
fs/cifs/file.c: In function collect_uncached_read_data:
fs/cifs/file.c:3578:20: warning: variable tcon set but not used [-Wunused-but-set-variable]

'cinode' is never used since introduced by
commit 03776f4516bc ("CIFS: Simplify byte range locking code")
'cifs_sb' is not used since commit cb7e9eabb2b5 ("CIFS: Use
multicredits for SMB 2.1/3 writes").
'tcon' is not used since commit d26e2903fc10 ("smb3: fix bytes_read statistics")

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
---
 fs/cifs/file.c | 7 -------
 1 file changed, 7 deletions(-)

diff --git a/fs/cifs/file.c b/fs/cifs/file.c
index ab07ae8..f16f6d2 100644
--- a/fs/cifs/file.c
+++ b/fs/cifs/file.c
@@ -1693,7 +1693,6 @@ int cifs_lock(struct file *file, int cmd, struct file_lock *flock)
 	bool posix_lck = false;
 	struct cifs_sb_info *cifs_sb;
 	struct cifs_tcon *tcon;
-	struct cifsInodeInfo *cinode;
 	struct cifsFileInfo *cfile;
 	__u32 type;
 
@@ -1710,7 +1709,6 @@ int cifs_lock(struct file *file, int cmd, struct file_lock *flock)
 	cifs_read_flock(flock, &type, &lock, &unlock, &wait_flag,
 			tcon->ses->server);
 	cifs_sb = CIFS_FILE_SB(file);
-	cinode = CIFS_I(file_inode(file));
 
 	if (cap_unix(tcon->ses) &&
 	    (CIFS_UNIX_FCNTL_CAP & le64_to_cpu(tcon->fsUnixInfo.Capability)) &&
@@ -1762,7 +1760,6 @@ cifs_write(struct cifsFileInfo *open_file, __u32 pid, const char *write_data,
 	int rc = 0;
 	unsigned int bytes_written = 0;
 	unsigned int total_written;
-	struct cifs_sb_info *cifs_sb;
 	struct cifs_tcon *tcon;
 	struct TCP_Server_Info *server;
 	unsigned int xid;
@@ -1770,8 +1767,6 @@ cifs_write(struct cifsFileInfo *open_file, __u32 pid, const char *write_data,
 	struct cifsInodeInfo *cifsi = CIFS_I(d_inode(dentry));
 	struct cifs_io_parms io_parms;
 
-	cifs_sb = CIFS_SB(dentry->d_sb);
-
 	cifs_dbg(FYI, "write %zd bytes to offset %lld of %pd\n",
 		 write_size, *offset, dentry);
 
@@ -3575,10 +3570,8 @@ collect_uncached_read_data(struct cifs_aio_ctx *ctx)
 	struct cifs_readdata *rdata, *tmp;
 	struct iov_iter *to = &ctx->iter;
 	struct cifs_sb_info *cifs_sb;
-	struct cifs_tcon *tcon;
 	int rc;
 
-	tcon = tlink_tcon(ctx->cfile->tlink);
 	cifs_sb = CIFS_SB(ctx->cfile->dentry->d_sb);
 
 	mutex_lock(&ctx->aio_mutex);
-- 
2.7.4



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH -next] cifs: remove set but not used variables
  2019-08-23 12:15 [PATCH -next] cifs: remove set but not used variables YueHaibing
@ 2019-08-26  0:47 ` Steve French
  0 siblings, 0 replies; 2+ messages in thread
From: Steve French @ 2019-08-26  0:47 UTC (permalink / raw)
  To: YueHaibing; +Cc: Steve French, CIFS, samba-technical, LKML

merged into cifs-2.6.git for-next

On Fri, Aug 23, 2019 at 6:11 PM YueHaibing <yuehaibing@huawei.com> wrote:
>
> Fixes gcc '-Wunused-but-set-variable' warning:
>
> fs/cifs/file.c: In function cifs_lock:
> fs/cifs/file.c:1696:24: warning: variable cinode set but not used [-Wunused-but-set-variable]
> fs/cifs/file.c: In function cifs_write:
> fs/cifs/file.c:1765:23: warning: variable cifs_sb set but not used [-Wunused-but-set-variable]
> fs/cifs/file.c: In function collect_uncached_read_data:
> fs/cifs/file.c:3578:20: warning: variable tcon set but not used [-Wunused-but-set-variable]
>
> 'cinode' is never used since introduced by
> commit 03776f4516bc ("CIFS: Simplify byte range locking code")
> 'cifs_sb' is not used since commit cb7e9eabb2b5 ("CIFS: Use
> multicredits for SMB 2.1/3 writes").
> 'tcon' is not used since commit d26e2903fc10 ("smb3: fix bytes_read statistics")
>
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: YueHaibing <yuehaibing@huawei.com>
> ---
>  fs/cifs/file.c | 7 -------
>  1 file changed, 7 deletions(-)
>
> diff --git a/fs/cifs/file.c b/fs/cifs/file.c
> index ab07ae8..f16f6d2 100644
> --- a/fs/cifs/file.c
> +++ b/fs/cifs/file.c
> @@ -1693,7 +1693,6 @@ int cifs_lock(struct file *file, int cmd, struct file_lock *flock)
>         bool posix_lck = false;
>         struct cifs_sb_info *cifs_sb;
>         struct cifs_tcon *tcon;
> -       struct cifsInodeInfo *cinode;
>         struct cifsFileInfo *cfile;
>         __u32 type;
>
> @@ -1710,7 +1709,6 @@ int cifs_lock(struct file *file, int cmd, struct file_lock *flock)
>         cifs_read_flock(flock, &type, &lock, &unlock, &wait_flag,
>                         tcon->ses->server);
>         cifs_sb = CIFS_FILE_SB(file);
> -       cinode = CIFS_I(file_inode(file));
>
>         if (cap_unix(tcon->ses) &&
>             (CIFS_UNIX_FCNTL_CAP & le64_to_cpu(tcon->fsUnixInfo.Capability)) &&
> @@ -1762,7 +1760,6 @@ cifs_write(struct cifsFileInfo *open_file, __u32 pid, const char *write_data,
>         int rc = 0;
>         unsigned int bytes_written = 0;
>         unsigned int total_written;
> -       struct cifs_sb_info *cifs_sb;
>         struct cifs_tcon *tcon;
>         struct TCP_Server_Info *server;
>         unsigned int xid;
> @@ -1770,8 +1767,6 @@ cifs_write(struct cifsFileInfo *open_file, __u32 pid, const char *write_data,
>         struct cifsInodeInfo *cifsi = CIFS_I(d_inode(dentry));
>         struct cifs_io_parms io_parms;
>
> -       cifs_sb = CIFS_SB(dentry->d_sb);
> -
>         cifs_dbg(FYI, "write %zd bytes to offset %lld of %pd\n",
>                  write_size, *offset, dentry);
>
> @@ -3575,10 +3570,8 @@ collect_uncached_read_data(struct cifs_aio_ctx *ctx)
>         struct cifs_readdata *rdata, *tmp;
>         struct iov_iter *to = &ctx->iter;
>         struct cifs_sb_info *cifs_sb;
> -       struct cifs_tcon *tcon;
>         int rc;
>
> -       tcon = tlink_tcon(ctx->cfile->tlink);
>         cifs_sb = CIFS_SB(ctx->cfile->dentry->d_sb);
>
>         mutex_lock(&ctx->aio_mutex);
> --
> 2.7.4
>
>


-- 
Thanks,

Steve

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-23 12:15 [PATCH -next] cifs: remove set but not used variables YueHaibing
2019-08-26  0:47 ` Steve French

Linux-CIFS Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-cifs/0 linux-cifs/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-cifs linux-cifs/ https://lore.kernel.org/linux-cifs \
		linux-cifs@vger.kernel.org linux-cifs@archiver.kernel.org
	public-inbox-index linux-cifs


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-cifs


AGPL code for this site: git clone https://public-inbox.org/ public-inbox