* [PATCH 0/7] delete double assignment
@ 2014-08-23 18:33 Julia Lawall
2014-08-23 18:33 ` [PATCH 4/7] MIPS: BCM63xx: " Julia Lawall
0 siblings, 1 reply; 4+ messages in thread
From: Julia Lawall @ 2014-08-23 18:33 UTC (permalink / raw)
To: linux-mips
Cc: joe, kernel-janitors, linux-kernel, linux-fbdev, linux-serial,
linux-usb
These patches fix cases where there are two adjacent assignments to the
same location. In practice, many such occurrences appear to be
intentional, eg to initialize volatile memory, but these cases do not seem
to fall into that category.
The complete semantic match that finds these problems is as follows:
// <smpl>
@r@
expression i,f;
position p1,p2;
@@
(
i = <+...f(...)...+>;
|
i |= <+...f(...)...+>;
|
i &= <+...f(...)...+>;
|
i += <+...f(...)...+>;
|
i -= <+...f(...)...+>;
|
i *= <+...f(...)...+>;
|
i /= <+...f(...)...+>;
|
i %= <+...f(...)...+>;
|
i ^= <+...f(...)...+>;
|
i <<= <+...f(...)...+>;
|
i >>= <+...f(...)...+>;
|
i@p1 = ...;
|
i@p1 |= ...;
|
i@p1 &= ...;
|
i@p1 += ...;
|
i@p1 -= ...;
|
i@p1 *= ...;
|
i@p1 /= ...;
|
i@p1 %= ...;
|
i@p1 ^= ...;
|
i@p1 <<= ...;
|
i@p1 >>= ...;
|
i@p1 ++;
|
++i@p1;
|
i@p1 --;
|
--i@p1;
)
(
i = <+...i...+>;
|
i = <+...f(...)...+>;
|
i@p2 = ...;
)
@@
expression i,j,f;
position r.p1,r.p2;
@@
(
(<+...i@p1...+>);
)
(
(<+...\(j++\|++j\|j--\|--j\|f(...)\)...+>) = ...;
|
*i@p2 = ...;
)
// </smpl>
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 4/7] MIPS: BCM63xx: delete double assignment
2014-08-23 18:33 [PATCH 0/7] delete double assignment Julia Lawall
@ 2014-08-23 18:33 ` Julia Lawall
2014-08-25 11:27 ` Ralf Baechle
0 siblings, 1 reply; 4+ messages in thread
From: Julia Lawall @ 2014-08-23 18:33 UTC (permalink / raw)
To: Ralf Baechle; +Cc: joe, kernel-janitors, linux-mips, linux-kernel
From: Julia Lawall <Julia.Lawall@lip6.fr>
Delete successive assignments to the same location. In each case, the
duplicated assignment is modified to be in line with other nearby code.
A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)
// <smpl>
@@
expression i;
@@
*i = ...;
i = ...;
// </smpl>
Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
---
The patches in this series do not depend on each other.
Not compiled. This patch changes the semantics of the code.
arch/mips/bcm63xx/irq.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/mips/bcm63xx/irq.c b/arch/mips/bcm63xx/irq.c
index 37eb2d1..b94bf44 100644
--- a/arch/mips/bcm63xx/irq.c
+++ b/arch/mips/bcm63xx/irq.c
@@ -434,7 +434,7 @@ static void bcm63xx_init_irq(void)
irq_stat_addr[0] += PERF_IRQSTAT_3368_REG;
irq_mask_addr[0] += PERF_IRQMASK_3368_REG;
irq_stat_addr[1] = 0;
- irq_stat_addr[1] = 0;
+ irq_mask_addr[1] = 0;
irq_bits = 32;
ext_irq_count = 4;
ext_irq_cfg_reg1 = PERF_EXTIRQ_CFG_REG_3368;
@@ -443,7 +443,7 @@ static void bcm63xx_init_irq(void)
irq_stat_addr[0] += PERF_IRQSTAT_6328_REG(0);
irq_mask_addr[0] += PERF_IRQMASK_6328_REG(0);
irq_stat_addr[1] += PERF_IRQSTAT_6328_REG(1);
- irq_stat_addr[1] += PERF_IRQMASK_6328_REG(1);
+ irq_mask_addr[1] += PERF_IRQMASK_6328_REG(1);
irq_bits = 64;
ext_irq_count = 4;
is_ext_irq_cascaded = 1;
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 4/7] MIPS: BCM63xx: delete double assignment
2014-08-23 18:33 ` [PATCH 4/7] MIPS: BCM63xx: " Julia Lawall
@ 2014-08-25 11:27 ` Ralf Baechle
2014-08-25 19:09 ` Jonas Gorski
0 siblings, 1 reply; 4+ messages in thread
From: Ralf Baechle @ 2014-08-25 11:27 UTC (permalink / raw)
To: Julia Lawall; +Cc: joe, kernel-janitors, linux-mips, linux-kernel
On Sat, Aug 23, 2014 at 08:33:25PM +0200, Julia Lawall wrote:
> Delete successive assignments to the same location. In each case, the
> duplicated assignment is modified to be in line with other nearby code.
>
> A simplified version of the semantic match that finds this problem is as
> follows: (http://coccinelle.lip6.fr/)
Looking good, applied.
Thanks,
Ralf
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 4/7] MIPS: BCM63xx: delete double assignment
2014-08-25 11:27 ` Ralf Baechle
@ 2014-08-25 19:09 ` Jonas Gorski
0 siblings, 0 replies; 4+ messages in thread
From: Jonas Gorski @ 2014-08-25 19:09 UTC (permalink / raw)
To: Ralf Baechle
Cc: Julia Lawall, joe, kernel-janitors, MIPS Mailing List,
linux-kernel@vger.kernel.org
On Mon, Aug 25, 2014 at 1:27 PM, Ralf Baechle <ralf@linux-mips.org> wrote:
> On Sat, Aug 23, 2014 at 08:33:25PM +0200, Julia Lawall wrote:
>
>> Delete successive assignments to the same location. In each case, the
>> duplicated assignment is modified to be in line with other nearby code.
>>
>> A simplified version of the semantic match that finds this problem is as
>> follows: (http://coccinelle.lip6.fr/)
>
> Looking good, applied.
Huh, somehow gmail decided the original emails were spam.
> Thanks,
>
> Ralf
Also thanks from me for cleaning up behind me! These mistakes were
definitely mine.
Jonas
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-08-25 19:10 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-23 18:33 [PATCH 0/7] delete double assignment Julia Lawall
2014-08-23 18:33 ` [PATCH 4/7] MIPS: BCM63xx: " Julia Lawall
2014-08-25 11:27 ` Ralf Baechle
2014-08-25 19:09 ` Jonas Gorski
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox