Skip to contentSkip to conversation

procfs: Drop cast

PATCH New Himangi Saraogi 1 participant 1 message Jun 28, 2014 Proc filesystem

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 procfs: 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/proc/generic.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/proc/generic.c +1 -1
index b7f268e..f599d43 100644
@@ -372,7 +372,7 @@ struct proc_dir_entry *proc_symlink(const char *name,
 	if (ent) {
 		ent->data = kmalloc((ent->size=strlen(dest))+1, GFP_KERNEL);
 		if (ent->data) {
-			strcpy((char*)ent->data,dest);
+			strcpy(ent->data, dest);
 			if (proc_register(parent, ent) < 0) {
 				kfree(ent->data);
 				kfree(ent);
Signature · 1 line
1.9.1