Skip to contentSkip to conversation

cifs Fix warnings variables set but not used

PATCH Superseded Justin P. Mattock 2 participants 6 messages Jun 19, 2010 – Jun 21, 2010 VFS

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 3/6 cifs Fix warnings variables set but not used

This is a resend of the original, to fix whitespace issues and to maybe do a better job with the issue.

The patch below fixes the warning messages from
gcc 4.6.0 and compiling the kernel.
CC [M] fs/cifs/cifssmb.o
fs/cifs/cifssmb.c: In function 'CIFSSMBSetFileSize':
fs/cifs/cifssmb.c:4855:8: warning: variable 'data_offset' set but not used
CC [M] fs/cifs/cifs_debug.o

CC [M] fs/cifs/dir.o
fs/cifs/dir.c: In function 'cifs_lookup':
fs/cifs/dir.c:641:15: warning: variable 'filp' set but not used

CC [M] fs/cifs/file.o
fs/cifs/file.c: In function 'cifs_partialpagewrite':
fs/cifs/file.c:1315:23: warning: variable 'pTcon' set but not used

---
 fs/cifs/cifssmb.c |    2 +-
 fs/cifs/dir.c     |    3 +--
 fs/cifs/file.c    |    2 +-
 3 files changed, 3 insertions(+), 4 deletions(-)
fs/cifs/cifssmb.c +1 -1
index c65c341..197349c 100644
@@ -4852,7 +4852,7 @@ CIFSSMBSetFileSize(const int xid, struct cifsTconInfo *tcon, __u64 size,
 		   __u16 fid, __u32 pid_of_opener, bool SetAllocation)
 {
 	struct smb_com_transaction2_sfi_req *pSMB  = NULL;
-	char *data_offset;
+	char *data_offset __attribute__((unused));
 	struct file_end_of_file_info *parm_data;
 	int rc = 0;
 	__u16 params, param_offset, offset, byte_count, count;
fs/cifs/dir.c +1 -2
index 391816b..b3d1be2 100644
@@ -638,7 +638,6 @@ cifs_lookup(struct inode *parent_dir_inode, struct dentry *direntry,
 	struct cifsTconInfo *pTcon;
 	struct inode *newInode = NULL;
 	char *full_path = NULL;
-	struct file *filp;
 
 	xid = GetXid();
 
@@ -734,7 +733,7 @@ cifs_lookup(struct inode *parent_dir_inode, struct dentry *direntry,
 			direntry->d_op = &cifs_dentry_ops;
 		d_add(direntry, newInode);
 		if (posix_open)
-			filp = lookup_instantiate_filp(nd, direntry, NULL);
+			lookup_instantiate_filp(nd, direntry, NULL);
 		/* since paths are not looked up by component - the parent
 		   directories are presumed to be good here */
 		renew_parental_timestamps(direntry);
fs/cifs/file.c +1 -1
index 75541af..73e540b 100644
@@ -1312,7 +1312,7 @@ static int cifs_partialpagewrite(struct page *page, unsigned from, unsigned to)
 	int rc = -EFAULT;
 	int bytes_written = 0;
 	struct cifs_sb_info *cifs_sb;
-	struct cifsTconInfo *pTcon;
+	struct cifsTconInfo *pTcon __attribute__((unused));
 	struct inode *inode;
 	struct cifsFileInfo *open_file;
 
Signature · 1 line
1.7.1.rc1.21.gf3bd6
#1 lore raw
Quoted 32 lines · On Sat, 19 Jun 2010 13:47:07 -0700 "Justin P. Mattock"…

This is a resend of the original, to fix whitespace issues and to maybe do a better job with the issue.

The patch below fixes the warning messages from
gcc 4.6.0 and compiling the kernel.
CC [M] fs/cifs/cifssmb.o
fs/cifs/cifssmb.c: In function 'CIFSSMBSetFileSize':
fs/cifs/cifssmb.c:4855:8: warning: variable 'data_offset' set but not used
CC [M] fs/cifs/cifs_debug.o

CC [M] fs/cifs/dir.o
fs/cifs/dir.c: In function 'cifs_lookup':
fs/cifs/dir.c:641:15: warning: variable 'filp' set but not used

CC [M] fs/cifs/file.o
fs/cifs/file.c: In function 'cifs_partialpagewrite':
fs/cifs/file.c:1315:23: warning: variable 'pTcon' set but not used

---
 fs/cifs/cifssmb.c |    2 +-
 fs/cifs/dir.c     |    3 +--
 fs/cifs/file.c    |    2 +-
 3 files changed, 3 insertions(+), 4 deletions(-)
fs/cifs/cifssmb.c +0 -0
index c65c341..197349c 100644

fs/cifs/cifssmb.c CIFSSMBSetFileSize(const int xid, struct cifsTconInfo *tcon, __u64 size, · line 4855

Quoted 5 lines
fs/cifs/cifssmb.c +1 -1
@@ -4852,7 +4852,7 @@ CIFSSMBSetFileSize(const int xid, struct cifsTconInfo *tcon, __u64 size,
 		   __u16 fid, __u32 pid_of_opener, bool SetAllocation)
 {
 	struct smb_com_transaction2_sfi_req *pSMB  = NULL;
-	char *data_offset;
+	char *data_offset __attribute__((unused));

It would be better to just remove this variable and the place where it gets set.

Quoted 16 lines
fs/cifs/cifssmb.c +0 -0
 	struct file_end_of_file_info *parm_data;
 	int rc = 0;
 	__u16 params, param_offset, offset, byte_count, count;
fs/cifs/dir.c +0 -1
index 391816b..b3d1be2 100644
@@ -638,7 +638,6 @@ cifs_lookup(struct inode *parent_dir_inode, struct dentry *direntry,
 	struct cifsTconInfo *pTcon;
 	struct inode *newInode = NULL;
 	char *full_path = NULL;
-	struct file *filp;
 
 	xid = GetXid();
 

fs/cifs/dir.c cifs_lookup(struct inode *parent_dir_inode, struct dentry *direntry, · line 736

Quoted 5 lines
fs/cifs/dir.c +1 -1
@@ -734,7 +733,7 @@ cifs_lookup(struct inode *parent_dir_inode, struct dentry *direntry,
 			direntry->d_op = &cifs_dentry_ops;
 		d_add(direntry, newInode);
 		if (posix_open)
-			filp = lookup_instantiate_filp(nd, direntry, NULL);
+			lookup_instantiate_filp(nd, direntry, NULL);

This part of the patch will conflict with some changes that are coming to this area. With those, "filp" will actually be used. You may want to wait until Linus pulls the latest fixes from Steve F's tree (or just base your patch on Steve's tree in the first place).

fs/cifs/file.c static int cifs_partialpagewrite(struct page *page, unsigned from, unsigned to) · line 1315

Quoted 13 lines
fs/cifs/dir.c +0 -0
 		/* since paths are not looked up by component - the parent
 		   directories are presumed to be good here */
 		renew_parental_timestamps(direntry);
fs/cifs/file.c +1 -1
index 75541af..73e540b 100644
@@ -1312,7 +1312,7 @@ static int cifs_partialpagewrite(struct page *page, unsigned from, unsigned to)
 	int rc = -EFAULT;
 	int bytes_written = 0;
 	struct cifs_sb_info *cifs_sb;
-	struct cifsTconInfo *pTcon;
+	struct cifsTconInfo *pTcon __attribute__((unused));

This variable can just be removed (along with the spot where it gets set later).

Quoted 3 lines
fs/cifs/file.c +0 -0
 	struct inode *inode;
 	struct cifsFileInfo *open_file;
 
Signature · 1 line
Jeff Layton <[email protected]>
#2 lore raw
Quoted 30 lines · Jeff Layton
Quoted 27 lines · On Sat, 19 Jun 2010 13:47:07 -0700 "Justin P.…

This is a resend of the original, to fix whitespace issues and to maybe do a better job with the issue.

The patch below fixes the warning messages from
gcc 4.6.0 and compiling the kernel.
CC [M] fs/cifs/cifssmb.o
fs/cifs/cifssmb.c: In function 'CIFSSMBSetFileSize':
fs/cifs/cifssmb.c:4855:8: warning: variable 'data_offset' set but not used
CC [M] fs/cifs/cifs_debug.o

CC [M] fs/cifs/dir.o
fs/cifs/dir.c: In function 'cifs_lookup':
fs/cifs/dir.c:641:15: warning: variable 'filp' set but not used

CC [M] fs/cifs/file.o
fs/cifs/file.c: In function 'cifs_partialpagewrite':
fs/cifs/file.c:1315:23: warning: variable 'pTcon' set but not used

---
  fs/cifs/cifssmb.c |    2 +-
  fs/cifs/dir.c     |    3 +--
  fs/cifs/file.c    |    2 +-
  3 files changed, 3 insertions(+), 4 deletions(-)
Quoted 14 lines

fs/cifs/cifssmb.c CIFSSMBSetFileSize(const int xid, struct cifsTconInfo *tcon, __u64 size, · line 4855

Quoted 10 lines
fs/cifs/cifssmb.c +1 -1
index c65c341..197349c 100644
@@ -4852,7 +4852,7 @@ CIFSSMBSetFileSize(const int xid, struct cifsTconInfo *tcon, __u64 size,
  		   __u16 fid, __u32 pid_of_opener, bool SetAllocation)
  {
  	struct smb_com_transaction2_sfi_req *pSMB  = NULL;
-	char *data_offset;
+	char *data_offset __attribute__((unused));

It would be better to just remove this variable and the place where it gets set.

I'll resend an update patch for cifssmb.c and file.c and just wait until dir.c get's updated with the new stuff..

Quoted 15 lines
Quoted 15 lines
fs/cifs/cifssmb.c +0 -0
  	struct file_end_of_file_info *parm_data;
  	int rc = 0;
  	__u16 params, param_offset, offset, byte_count, count;
fs/cifs/dir.c +0 -1
index 391816b..b3d1be2 100644
@@ -638,7 +638,6 @@ cifs_lookup(struct inode *parent_dir_inode, struct dentry *direntry,
  	struct cifsTconInfo *pTcon;
  	struct inode *newInode = NULL;
  	char *full_path = NULL;
-	struct file *filp;
 
  	xid = GetXid();
 
Quoted 12 lines

fs/cifs/dir.c cifs_lookup(struct inode *parent_dir_inode, struct dentry *direntry, · line 736

Quoted 6 lines
fs/cifs/dir.c +1 -1
@@ -734,7 +733,7 @@ cifs_lookup(struct inode *parent_dir_inode, struct dentry *direntry,
  			direntry->d_op =&cifs_dentry_ops;
  		d_add(direntry, newInode);
  		if (posix_open)
-			filp = lookup_instantiate_filp(nd, direntry, NULL);
+			lookup_instantiate_filp(nd, direntry, NULL);

This part of the patch will conflict with some changes that are coming to this area. With those, "filp" will actually be used. You may want to wait until Linus pulls the latest fixes from Steve F's tree (or just base your patch on Steve's tree in the first place).

I'll just wait then..

Quoted 23 lines
Quoted 9 lines
fs/cifs/dir.c +0 -0
  		/* since paths are not looked up by component - the parent
  		   directories are presumed to be good here */
  		renew_parental_timestamps(direntry);
fs/cifs/file.c +0 -0
index 75541af..73e540b 100644

fs/cifs/file.c static int cifs_partialpagewrite(struct page *page, unsigned from, unsigned to) · line 1315

Quoted 5 lines
fs/cifs/file.c +1 -1
@@ -1312,7 +1312,7 @@ static int cifs_partialpagewrite(struct page *page, unsigned from, unsigned to)
  	int rc = -EFAULT;
  	int bytes_written = 0;
  	struct cifs_sb_info *cifs_sb;
-	struct cifsTconInfo *pTcon;
+	struct cifsTconInfo *pTcon __attribute__((unused));

This variable can just be removed (along with the spot where it gets set later).

Quoted 3 lines
fs/cifs/file.c +0 -0
  	struct inode *inode;
  	struct cifsFileInfo *open_file;
 

cheers,

Justin P. Mattock

#3 lore raw
In reply to Jeff Layton
Quoted 23 lines
Quoted 9 lines

/* since paths are not looked up by component - the parent
directories are presumed to be good here */
renew_parental_timestamps(direntry);

fs/cifs/file.c +0 -0
index 75541af..73e540b 100644

fs/cifs/file.c static int cifs_partialpagewrite(struct page *page, unsigned from, unsigned to) · line 1315

Quoted 5 lines
fs/cifs/file.c +1 -1
@@ -1312,7 +1312,7 @@ static int cifs_partialpagewrite(struct page *page, unsigned from, unsigned to)
  	int rc = -EFAULT;
  	int bytes_written = 0;
  	struct cifs_sb_info *cifs_sb;
-	struct cifsTconInfo *pTcon;
+	struct cifsTconInfo *pTcon __attribute__((unused));

This variable can just be removed (along with the spot where it gets set later).

Quoted 3 lines
fs/cifs/file.c +0 -0
  	struct inode *inode;
  	struct cifsFileInfo *open_file;
 

one thing I want to make sure of before sending this out, is with file.c if I remove *pTcon another warning shows up:

CC [M] fs/cifs/file.o
fs/cifs/file.c: In function 'cifs_partialpagewrite':
fs/cifs/file.c:1314:23: warning: variable 'cifs_sb' set but not used

with the original patch I had removed this as well, should I do this or is this not a good idea?

Justin P. Mattock

#4 lore raw
Quoted 27 lines · On Sun, 20 Jun 2010 15:33:54 -0700 "Justin P. Mattock"…
Quoted 23 lines
Quoted 9 lines

/* since paths are not looked up by component - the parent
directories are presumed to be good here */
renew_parental_timestamps(direntry);

fs/cifs/file.c +0 -0
index 75541af..73e540b 100644

fs/cifs/file.c static int cifs_partialpagewrite(struct page *page, unsigned from, unsigned to) · line 1315

Quoted 5 lines
fs/cifs/file.c +1 -1
@@ -1312,7 +1312,7 @@ static int cifs_partialpagewrite(struct page *page, unsigned from, unsigned to)
  	int rc = -EFAULT;
  	int bytes_written = 0;
  	struct cifs_sb_info *cifs_sb;
-	struct cifsTconInfo *pTcon;
+	struct cifsTconInfo *pTcon __attribute__((unused));

This variable can just be removed (along with the spot where it gets set later).

Quoted 3 lines
fs/cifs/file.c +0 -0
  	struct inode *inode;
  	struct cifsFileInfo *open_file;
 

one thing I want to make sure of before sending this out, is with file.c if I remove *pTcon another warning shows up:

Quoted 6 lines

CC [M] fs/cifs/file.o
fs/cifs/file.c: In function 'cifs_partialpagewrite':
fs/cifs/file.c:1314:23: warning: variable 'cifs_sb' set but not used

with the original patch I had removed this as well, should I do this or is this not a good idea?

If it's not used, remove it...

Signature · 1 line
Jeff Layton <[email protected]>
#5 lore raw
Quoted 30 lines · Jeff Layton
Quoted 27 lines · On Sun, 20 Jun 2010 15:33:54 -0700 "Justin P.…
Quoted 23 lines
Quoted 9 lines
   		/* since paths are not looked up by component - the parent
   		   directories are presumed to be good here */
   		renew_parental_timestamps(direntry);
fs/cifs/file.c +0 -0
index 75541af..73e540b 100644

fs/cifs/file.c static int cifs_partialpagewrite(struct page *page, unsigned from, unsigned to) · line 1315

Quoted 5 lines
fs/cifs/file.c +1 -1
@@ -1312,7 +1312,7 @@ static int cifs_partialpagewrite(struct page *page, unsigned from, unsigned to)
   	int rc = -EFAULT;
   	int bytes_written = 0;
   	struct cifs_sb_info *cifs_sb;
-	struct cifsTconInfo *pTcon;
+	struct cifsTconInfo *pTcon __attribute__((unused));

This variable can just be removed (along with the spot where it gets set later).

Quoted 3 lines
fs/cifs/file.c +0 -0
   	struct inode *inode;
   	struct cifsFileInfo *open_file;
 

one thing I want to make sure of before sending this out, is with file.c if I remove *pTcon another warning shows up:

Quoted 9 lines
Quoted 6 lines

CC [M] fs/cifs/file.o
fs/cifs/file.c: In function 'cifs_partialpagewrite':
fs/cifs/file.c:1314:23: warning: variable 'cifs_sb' set but not used

with the original patch I had removed this as well, should I do this or is this not a good idea?

If it's not used, remove it...

alright, I'll send those two, then go from there.

Justin P. Mttock