[PATCH 7/7] drivers/net/can/cc770/cc770_platform.c: adjust suspicious bit operation

Subsystems: can network drivers, the rest

STALE5201d

2 messages, 2 authors, 2012-06-06 · open the first message on its own page

[PATCH 7/7] drivers/net/can/cc770/cc770_platform.c: adjust suspicious bit operation

From: Julia Lawall <hidden>
Date: 2012-06-06 21:42:00

From: Julia Lawall <redacted>

CPUIF_DSC is 0x40, so it would seem that & is wanted rather than |.

This problem was found using Coccinelle (http://coccinelle.lip6.fr/).

Signed-off-by: Julia Lawall <redacted>

---
 drivers/net/can/cc770/cc770_platform.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/can/cc770/cc770_platform.c b/drivers/net/can/cc770/cc770_platform.c
index 53115ee..688371c 100644
--- a/drivers/net/can/cc770/cc770_platform.c
+++ b/drivers/net/can/cc770/cc770_platform.c
@@ -154,7 +154,7 @@ static int __devinit cc770_get_platform_data(struct platform_device *pdev,
 	struct cc770_platform_data *pdata = pdev->dev.platform_data;
 
 	priv->can.clock.freq = pdata->osc_freq;
-	if (priv->cpu_interface | CPUIF_DSC)
+	if (priv->cpu_interface & CPUIF_DSC)
 		priv->can.clock.freq /= 2;
 	priv->clkout = pdata->cor;
 	priv->bus_config = pdata->bcr;

Re: [PATCH 7/7] drivers/net/can/cc770/cc770_platform.c: adjust suspicious bit operation

From: Marc Kleine-Budde <mkl@pengutronix.de>
Date: 2012-06-06 21:52:52

On 06/06/2012 11:41 PM, Julia Lawall wrote:
From: Julia Lawall <redacted>

CPUIF_DSC is 0x40, so it would seem that & is wanted rather than |.

This problem was found using Coccinelle (http://coccinelle.lip6.fr/).

Signed-off-by: Julia Lawall <redacted>
Good catch, Joe Perches has already found and fixed that problem. It has
been fixed in:

    dc605db can: cc770: Fix likely misuse of | for &

The commit is currently in David's net/master, and scheduled for the
v3.5 release.

Regards, Marc

-- 
Pengutronix e.K.                  | Marc Kleine-Budde           |
Industrial Linux Solutions        | Phone: +49-231-2826-924     |
Vertretung West/Dortmund          | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help