diff mbox

drivers/media/dvb-frontends/rtl2830.c: correct double assignment

Message ID 1345997751-340-1-git-send-email-Julia.Lawall@lip6.fr (mailing list archive)
State New, archived
Headers show

Commit Message

Julia Lawall Aug. 26, 2012, 4:15 p.m. UTC
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(-)


--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Antti Palosaari Aug. 26, 2012, 4:21 p.m. UTC | #1
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
diff mbox

Patch

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;