Skip to contentSkip to conversation

kernfs: Drop cast

PATCH New Himangi Saraogi 1 participant 1 message Jun 28, 2014 kernfs

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kernfs: Drop cast

This patch does away with cast on void * and the if as it is unnecessary.

The following Coccinelle semantic patch was used for making the change:

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

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

---
 fs/kernfs/dir.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/kernfs/dir.c +1 -1
index 1c77193..85738f4 100644
@@ -188,7 +188,7 @@ static unsigned int kernfs_name_hash(const char *name, const void *ns)
 	unsigned int len = strlen(name);
 	while (len--)
 		hash = partial_name_hash(*name++, hash);
-	hash = (end_name_hash(hash) ^ hash_ptr((void *)ns, 31));
+	hash = (end_name_hash(hash) ^ hash_ptr(ns, 31));
 	hash &= 0x7fffffffU;
 	/* Reserve hash numbers 0, 1 and INT_MAX for magic directory entries */
 	if (hash < 2)
Signature · 1 line
1.9.1