2008-06-23 21:12:46

by Julia Lawall

[permalink] [raw]
Subject: [PATCH] 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>

Signed-off-by: Julia Lawall <[email protected]>
---

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++;


2008-06-24 08:55:08

by Florian Fainelli

[permalink] [raw]
Subject: Re: [PATCH] drivers/net/r6040.c: Eliminate double sizeof

Hello Julia,

Le Monday 23 June 2008 23:12:31 Julia Lawall, vous avez ?crit?:
> 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.

> Signed-off-by: Julia Lawall <[email protected]>

Acked-by: Florian Fainelli <[email protected]>
--
Cordialement, Florian Fainelli
------------------------------

2008-06-27 05:34:29

by Jeff Garzik

[permalink] [raw]
Subject: Re: [PATCH] drivers/net/r6040.c: Eliminate double sizeof

Julia Lawall wrote:
> 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>
>
> Signed-off-by: Julia Lawall <[email protected]>

applied