Skip to contentSkip to conversation

drivers/net/r6040.c: Eliminate double sizeof

PATCH Applied Julia Lawall 3 participants 3 messages Jun 23, 2008 – Jun 27, 2008

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drivers/net/r6040.c: Eliminate double sizeof

From: Julia Lawall <[email protected]>

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>

---

drivers/net/r6040.c 2008-06-23 22:55:11.000000000 +0200 renamed from drivers/net/r6040.c 2008-06-17 19:46:52.000000000 +0200 +1 -1
diff -u -p a/drivers/net/r6040.c b/drivers/net/r6040.c
@@ -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++;
Acked-by on v1 1/1
#1 lore raw

Hello Julia,

Le Monday 23 June 2008 23:12:31 Julia Lawall, vous avez écrit :

Quoted 4 lines

From: Julia Lawall <[email protected]>

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

Yes, definitively.

Quoted 1 line
Signature · 6 lines
Cordialement, Florian Fainelli
------------------------------
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html