Skip to contentSkip to conversation

drivers: input: mouse: Remove useless casting in cypress_ps2.c

PATCH Superseded Geyslan G. Bem 2 participants 3 messages Oct 16, 2013

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drivers: input: mouse: Remove useless casting in cypress_ps2.c

Casting (void *) value returned by kzalloc is useless as mentioned in Documentation/CodingStyle, Chap 14.

---
 drivers/input/mouse/cypress_ps2.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/input/mouse/cypress_ps2.c +1 -1
index f51765f..ef651cc 100644
@@ -679,7 +679,7 @@ int cypress_init(struct psmouse *psmouse)
 {
 	struct cytp_data *cytp;
 
-	cytp = (struct cytp_data *)kzalloc(sizeof(struct cytp_data), GFP_KERNEL);
+	cytp = kzalloc(sizeof(struct cytp_data), GFP_KERNEL);
 	psmouse->private = (void *)cytp;
 	if (cytp == NULL)
 		return -ENOMEM;
Signature · 1 line
1.8.4
maintainer
#1 lore raw

Hi Geyslan,

Quoted 13 lines · Geyslan G. Bem

Casting (void *) value returned by kzalloc is useless as mentioned in Documentation/CodingStyle, Chap 14.

---
 drivers/input/mouse/cypress_ps2.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/input/mouse/cypress_ps2.c +0 -0
index f51765f..ef651cc 100644

drivers/input/mouse/cypress_ps2.c int cypress_init(struct psmouse *psmouse) · line 682

Quoted 5 lines
drivers/input/mouse/cypress_ps2.c +1 -1
@@ -679,7 +679,7 @@ int cypress_init(struct psmouse *psmouse)
 {
 	struct cytp_data *cytp;
 
-	cytp = (struct cytp_data *)kzalloc(sizeof(struct cytp_data), GFP_KERNEL);
+	cytp = kzalloc(sizeof(struct cytp_data), GFP_KERNEL);

I already have a patch for this from Jingoo Han in my queue.

drivers/input/mouse/cypress_ps2.c int cypress_init(struct psmouse *psmouse) · line 683

Quoted 1 line
drivers/input/mouse/cypress_ps2.c +0 -0
 	psmouse->private = (void *)cytp;

But this cast is also not needed, so if you could send me a patch for it I'd appreciate that.

Quoted 5 lines
drivers/input/mouse/cypress_ps2.c +0 -0
 	if (cytp == NULL)
 		return -ENOMEM;
Signature · 1 line
1.8.4

Thanks.

Signature · 1 line
Dmitry
#2 lore raw

2013/10/16 Dmitry Torokhov <[email protected]>:

Quoted 19 lines

Hi Geyslan,

Quoted 16 lines · Geyslan G. Bem

Casting (void *) value returned by kzalloc is useless as mentioned in Documentation/CodingStyle, Chap 14.

---
 drivers/input/mouse/cypress_ps2.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/input/mouse/cypress_ps2.c +0 -0
index f51765f..ef651cc 100644
@@ -679,7 +679,7 @@ int cypress_init(struct psmouse *psmouse)
 {
      struct cytp_data *cytp;
 
Quoted 4 lines

drivers/input/mouse/cypress_ps2.c int cypress_init(struct psmouse *psmouse) · line 682

Quoted 2 lines
drivers/input/mouse/cypress_ps2.c +1 -1
-     cytp = (struct cytp_data *)kzalloc(sizeof(struct cytp_data), GFP_KERNEL);
+     cytp = kzalloc(sizeof(struct cytp_data), GFP_KERNEL);

I already have a patch for this from Jingoo Han in my queue.

No problem.

Quoted 5 lines

drivers/input/mouse/cypress_ps2.c int cypress_init(struct psmouse *psmouse) · line 683

Quoted 2 lines
drivers/input/mouse/cypress_ps2.c +0 -0
      psmouse->private = (void *)cytp;

But this cast is also not needed, so if you could send me a patch for it I'd appreciate that.

Sure, I can.

Quoted 11 lines
Quoted 6 lines
drivers/input/mouse/cypress_ps2.c +0 -1
      if (cytp == NULL)
              return -ENOMEM;
--

1.8.4

Thanks.

--
Dmitry