coda: upcall: only set outp in upcalls that read the reply
PATCH 1/1 coda: upcall: only set outp in upcalls that read the reply
The UPARG() macro always assigns outp, but 10 of the upcall functions never read it. With W=1 this triggers -Wunused-but-set-variable in venus_setattr(), venus_close(), venus_rename(), venus_rmdir(), venus_remove(), venus_link(), venus_symlink(), venus_fsync(), venus_access() and venus_access_intent(), which breaks the build when CONFIG_WERROR is enabled.
Drop the outp assignment from UPARG(), remove the unused outp variables, and set outp explicitly in the upcalls that read the reply.
No functional change.
Assisted-by LLM
Signed-off-by Rosen Penev <[email protected]>
--- fs/coda/upcall.c | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-)
fs/coda/upcall.c +9 -11
@@ -62,7 +62,6 @@ static void *alloc_upcall(int opcode, int size)do {\ inp = (union inputArgs *)alloc_upcall (op, insize); \if (IS_ERR (inp)) {return PTR_ERR (inp); }\ - outp = (union outputArgs *)(inp); \ outsize = insize; \ }while (0 )
@@ -80,6 +79,7 @@ int venus_rootfid(struct super_block *sb, struct CodaFid *fidp) insize =SIZE (root);UPARG (CODA_ROOT ); + outp = (union outputArgs *)inp; error =coda_upcall (coda_vcp (sb), insize, &outsize, inp);if (!error)
@@ -98,6 +98,7 @@ int venus_getattr(struct super_block *sb, struct CodaFid *fid, insize =SIZE (getattr);UPARG (CODA_GETATTR ); + outp = (union outputArgs *)inp; inp->coda_getattr.VFid = *fid; error =coda_upcall (coda_vcp (sb), insize, &outsize, inp);
@@ -112,7 +113,6 @@ int venus_setattr(struct super_block *sb, struct CodaFid *fid, struct coda_vattr *vattr) {union inputArgs *inp; -union outputArgs *outp;int insize, outsize, error; insize =SIZE (setattr);
@@ -139,6 +139,7 @@ int venus_lookup(struct super_block *sb, struct CodaFid *fid, offset =INSIZE (lookup); insize = max_t(unsigned int, offset + length +1, OUTSIZE(lookup));UPARG (CODA_LOOKUP ); + outp = (union outputArgs *)inp; inp->coda_lookup.VFid = *fid; inp->coda_lookup.name = offset;
@@ -161,7 +162,6 @@ int venus_close(struct super_block *sb, struct CodaFid *fid, int flags, kuid_t uid) {union inputArgs *inp; -union outputArgs *outp;int insize, outsize, error; insize =SIZE (release);
@@ -186,6 +186,7 @@ int venus_open(struct super_block *sb, struct CodaFid *fid, insize =SIZE (open_by_fd);UPARG (CODA_OPEN_BY_FD ); + outp = (union outputArgs *)inp; inp->coda_open_by_fd.VFid = *fid; inp->coda_open_by_fd.flags = flags;
@@ -210,6 +211,7 @@ int venus_mkdir(struct super_block *sb, struct CodaFid *dirfid, offset =INSIZE (mkdir); insize = max_t(unsigned int, offset + length + 1, OUTSIZE(mkdir));UPARG (CODA_MKDIR ); + outp = (union outputArgs *)inp; inp->coda_mkdir.VFid = *dirfid; inp->coda_mkdir.attr = *attrs;
@@ -235,7 +237,6 @@ int venus_rename(struct super_block *sb, struct CodaFid *old_fid, const char *new_name) {union inputArgs *inp; -union outputArgs *outp;int insize, outsize, error;int offset, s;
@@ -278,6 +279,7 @@ int venus_create(struct super_block *sb, struct CodaFid *dirfid, offset =INSIZE (create); insize = max_t(unsigned int, offset + length + 1, OUTSIZE(create));UPARG (CODA_CREATE ); + outp = (union outputArgs *)inp; inp->coda_create.VFid = *dirfid; inp->coda_create.attr.va_mode = mode;
@@ -303,7 +305,6 @@ int venus_rmdir(struct super_block *sb, struct CodaFid *dirfid, const char *name, int length) {union inputArgs *inp; -union outputArgs *outp;int insize, outsize, error;int offset;
@@ -326,7 +327,6 @@ int venus_remove(struct super_block *sb, struct CodaFid *dirfid, const char *name, int length) {union inputArgs *inp; -union outputArgs *outp;int error=0 , insize, outsize, offset; offset =INSIZE (remove);
@@ -356,6 +356,7 @@ int venus_readlink(struct super_block *sb, struct CodaFid *fid, insize = max_t(unsigned int,INSIZE (readlink),OUTSIZE (readlink)+ *length);UPARG (CODA_READLINK ); + outp = (union outputArgs *)inp; inp->coda_readlink.VFid = *fid;
@@ -380,7 +381,6 @@ int venus_link(struct super_block *sb, struct CodaFid *fid, struct CodaFid *dirfid, const char *name, int len ) { union inputArgs *inp; -union outputArgs *outp;int insize, outsize, error;int offset;
@@ -407,7 +407,6 @@ int venus_symlink(struct super_block *sb, struct CodaFid *fid, const char *symname, int symlen) {union inputArgs *inp; -union outputArgs *outp;int insize, outsize, error;int offset, s;
@@ -440,7 +439,6 @@ int venus_symlink(struct super_block *sb, struct CodaFid *fid,int venus_fsync (struct super_block *sb,struct CodaFid *fid) {union inputArgs *inp; -union outputArgs *outp;int insize, outsize, error; insize=SIZE (fsync);
@@ -456,7 +454,6 @@ int venus_fsync(struct super_block *sb, struct CodaFid *fid)int venus_access (struct super_block *sb,struct CodaFid *fid,int mask) {union inputArgs *inp; -union outputArgs *outp;int insize, outsize, error; insize =SIZE (access);
@@ -482,6 +479,7 @@ int venus_pioctl(struct super_block *sb, struct CodaFid *fid, insize =VC_MAXMSGSIZE ;UPARG (CODA_IOCTL ); + outp = (union outputArgs *)inp;/* build packet for Venus */ if (data->vi.in_size >VC_MAXDATASIZE ) {
@@ -555,6 +553,7 @@ int venus_statfs(struct dentry *dentry, struct kstatfs *sfs) insize =SIZE (statfs);UPARG (CODA_STATFS ); + outp = (union outputArgs *)inp; error =coda_upcall (coda_vcp (dentry->d_sb), insize, &outsize, inp);if (!error) {
@@ -574,7 +573,6 @@ int venus_access_intent(struct super_block *sb, struct CodaFid *fid, size_t count, loff_t ppos, int type) { union inputArgs *inp; -union outputArgs *outp;int insize, outsize, error;bool finalizer = type == CODA_ACCESS_TYPE_READ_FINISH ||
Signature · 1 line
2.56.0