Skip to contentSkip to conversation

arch/powerpc: Eliminate double sizeof

PATCH Applied Julia Lawall 3 participants 3 messages Feb 4, 2009 – Feb 6, 2009

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

PATCH 1/1 arch/powerpc: 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)
- )

@@
type T;
@@

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

---
 arch/powerpc/platforms/82xx/pq2ads-pci-pic.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/platforms/82xx/pq2ads-pci-pic.c +1 -1
diff -u -p a/arch/powerpc/platforms/82xx/pq2ads-pci-pic.c b/arch/powerpc/platforms/82xx/pq2ads-pci-pic.c
@@ -186,7 +186,7 @@ out_unmap_regs:
 	iounmap(priv->regs);
 out_free_bootmem:
 	free_bootmem((unsigned long)priv,
-	             sizeof(sizeof(struct pq2ads_pci_pic)));
+	             sizeof(struct pq2ads_pci_pic));
 	of_node_put(np);
 out_unmap_irq:
 	irq_dispose_mapping(irq);
#1 lore raw
Quoted 9 lines · Julia Lawall
---
 arch/powerpc/platforms/82xx/pq2ads-pci-pic.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff -u -p a/arch/powerpc/platforms/82xx/pq2ads-pci-pic.c b/arch/powerpc/platforms/82xx/pq2ads-pci-pic.c

arch/powerpc/platforms/82xx/pq2ads-pci-pic.c out_unmap_regs: · line 192

Quoted 8 lines
arch/powerpc/platforms/82xx/pq2ads-pci-pic.c +1 -1
@@ -186,7 +186,7 @@ out_unmap_regs:
 	iounmap(priv->regs);
 out_free_bootmem:
 	free_bootmem((unsigned long)priv,
-	             sizeof(sizeof(struct pq2ads_pci_pic)));
+	             sizeof(struct pq2ads_pci_pic));
 	of_node_put(np);
 out_unmap_irq:
 	irq_dispose_mapping(irq);

ACK

-Scott

Applied
#2 lore raw
In reply to Julia Lawall
Quoted 27 lines · Julia Lawall

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)
- )

@@
type T;
@@

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

Quoted 4 lines

---
arch/powerpc/platforms/82xx/pq2ads-pci-pic.c | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-)

applied

- k