linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drivers/media/dvb-frontends/rtl2830.c: correct double assignment
@ 2012-08-26 16:15 Julia Lawall
  2012-08-26 16:21 ` Antti Palosaari
  0 siblings, 1 reply; 2+ messages in thread
From: Julia Lawall @ 2012-08-26 16:15 UTC (permalink / raw)
  To: Mauro Carvalho Chehab
  Cc: kernel-janitors, linux-media, linux-kernel, crope, awalls

From: Julia Lawall <Julia.Lawall@lip6.fr>

The double assignment is meant to be a bit-or to combine two values.

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>

---
 drivers/media/dvb-frontends/rtl2830.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/dvb-frontends/rtl2830.c b/drivers/media/dvb-frontends/rtl2830.c
index 8fa8b08..b6ab858 100644
--- a/drivers/media/dvb-frontends/rtl2830.c
+++ b/drivers/media/dvb-frontends/rtl2830.c
@@ -254,7 +254,7 @@ static int rtl2830_init(struct dvb_frontend *fe)
 		goto err;
 
 	buf[0] = tmp << 6;
-	buf[0] = (if_ctl >> 16) & 0x3f;
+	buf[0] |= (if_ctl >> 16) & 0x3f;
 	buf[1] = (if_ctl >>  8) & 0xff;
 	buf[2] = (if_ctl >>  0) & 0xff;
 


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] drivers/media/dvb-frontends/rtl2830.c: correct double assignment
  2012-08-26 16:15 [PATCH] drivers/media/dvb-frontends/rtl2830.c: correct double assignment Julia Lawall
@ 2012-08-26 16:21 ` Antti Palosaari
  0 siblings, 0 replies; 2+ messages in thread
From: Antti Palosaari @ 2012-08-26 16:21 UTC (permalink / raw)
  To: Julia Lawall
  Cc: Mauro Carvalho Chehab, kernel-janitors, linux-media,
	linux-kernel, awalls

On 08/26/2012 07:15 PM, Julia Lawall wrote:
> From: Julia Lawall <Julia.Lawall@lip6.fr>
>
> The double assignment is meant to be a bit-or to combine two values.
>
> 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>
>
> ---
>   drivers/media/dvb-frontends/rtl2830.c |    2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/media/dvb-frontends/rtl2830.c b/drivers/media/dvb-frontends/rtl2830.c
> index 8fa8b08..b6ab858 100644
> --- a/drivers/media/dvb-frontends/rtl2830.c
> +++ b/drivers/media/dvb-frontends/rtl2830.c
> @@ -254,7 +254,7 @@ static int rtl2830_init(struct dvb_frontend *fe)
>   		goto err;
>
>   	buf[0] = tmp << 6;
> -	buf[0] = (if_ctl >> 16) & 0x3f;
> +	buf[0] |= (if_ctl >> 16) & 0x3f;
>   	buf[1] = (if_ctl >>  8) & 0xff;
>   	buf[2] = (if_ctl >>  0) & 0xff;
>
>
Thank you!

Acked-by: Antti Palosaari <crope@iki.fi>
Reviewed-by: Antti Palosaari <crope@iki.fi>


Antti
-- 
http://palosaari.fi/

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-08-26 16:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-08-26 16:15 [PATCH] drivers/media/dvb-frontends/rtl2830.c: correct double assignment Julia Lawall
2012-08-26 16:21 ` Antti Palosaari

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).