[PATCH] drivers/net/r6040.c: Eliminate double sizeof

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Julia Lawall
Date: Monday, June 23, 2008 - 2:12 pm

From: Julia Lawall <julia@diku.dk>

Taking sizeof the result of sizeof is quite strange and does not seem to be
what is wanted here.

This was fixed using the following semantic patch.
(http://www.emn.fr/x-info/coccinelle/)

// <smpl>
@@
expression E;
@@

- sizeof (
  sizeof (E)
- )
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
---

diff -u -p a/drivers/net/r6040.c b/drivers/net/r6040.c
--- a/drivers/net/r6040.c 2008-06-17 19:46:52.000000000 +0200
+++ b/drivers/net/r6040.c 2008-06-23 22:55:11.000000000 +0200
@@ -273,7 +273,7 @@ static void r6040_init_ring_desc(struct 
 	dma_addr_t mapping = desc_dma;
 
 	while (size-- > 0) {
-		mapping += sizeof(sizeof(*desc));
+		mapping += sizeof(*desc);
 		desc->ndesc = cpu_to_le32(mapping);
 		desc->vndescp = desc + 1;
 		desc++;
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH] drivers/net/r6040.c: Eliminate double sizeof, Julia Lawall, (Mon Jun 23, 2:12 pm)
Re: [PATCH] drivers/net/r6040.c: Eliminate double sizeof, Florian Fainelli, (Tue Jun 24, 1:54 am)