Skip to contentSkip to conversation

Remove useless cast on void pointer

PATCH New Amitoj Kaur Chawla 1 participant 3 messages Oct 13, 2015 Staging

lore
Share & tools
lore
#0 lore raw

cover Remove useless cast on void pointer

This patchset removes multiple useless cast on void pointer.

The semantic patch used to find this is:

@r@
expression x;
void* e;
type T;
identifier f;
@@

(
*((T *)e)
|
((T *)x)[...]
|
((T *)x)->f
|
- (T *)
e
)

Amitoj Kaur Chawla (2):
staging: lustre: llite: Remove useless cast on void pointer
staging: lustre: llite: Remove useless cast on void pointer

 drivers/staging/lustre/lustre/llite/llite_nfs.c | 3 +--
 drivers/staging/lustre/lustre/llite/xattr.c     | 2 +-
 2 files changed, 2 insertions(+), 3 deletions(-)
Signature · 1 line
1.9.1
#1 lore raw

PATCH 1/2 staging: lustre: llite: Remove useless cast on void pointer

The semantic patch used to find this is:

@r@
expression x;
void* e;
type T;
identifier f;
@@

(
*((T *)e)
|
((T *)x)[...]
|
((T *)x)->f
|
- (T *)
e
)

---
 drivers/staging/lustre/lustre/llite/llite_nfs.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/staging/lustre/lustre/llite/llite_nfs.c +1 -2
index 400acacc..f992eda1 100644
@@ -78,8 +78,7 @@ void get_uuid2fsid(const char *name, int len, __kernel_fsid_t *fsid)
 
 static int ll_nfs_test_inode(struct inode *inode, void *opaque)
 {
-	return lu_fid_eq(&ll_i2info(inode)->lli_fid,
-			 (struct lu_fid *)opaque);
+	return lu_fid_eq(&ll_i2info(inode)->lli_fid, opaque);
 }
 
 struct inode *search_inode_for_lustre(struct super_block *sb,
Signature · 1 line
1.9.1
#2 lore raw

PATCH 2/2 staging: lustre: llite: Remove useless cast on void pointer

In reply to Amitoj Kaur Chawla

The semantic patch used to find this is:

@r@
expression x;
void* e;
type T;
identifier f;
@@

(
*((T *)e)
|
((T *)x)[...]
|
((T *)x)->f
|
- (T *)
e
)

---
 drivers/staging/lustre/lustre/llite/xattr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/lustre/lustre/llite/xattr.c +1 -1
index e051dcc..4b7eb33 100644
@@ -519,7 +519,7 @@ ssize_t ll_getxattr(struct dentry *dentry, const char *name,
 			goto out;
 		}
 
-		lump = (struct lov_user_md *)buffer;
+		lump = buffer;
 		memcpy(lump, lmm, lmmsize);
 		/* do not return layout gen for getxattr otherwise it would
 		 * confuse tar --xattr by recognizing layout gen as stripe
Signature · 1 line
1.9.1