diff mbox

rtl2832.c: minor cleanup

Message ID 201207151956.47423.hfvogt@gmx.net (mailing list archive)
State New, archived
Headers show

Commit Message

Hans-Frieder Vogt July 15, 2012, 5:56 p.m. UTC
The current formulation of the bw_params loop uses the counter j as an index for the first dimension of the
bw_params array which is later incremented by the variable i.
It is evaluated correctly only, because j is initialized to 0 at the beginning of the loop.
I think that explicitly using the index 0 better reflects the intent of the expression.

Signed-off-by: Hans-Frieder Vogt <hfvogt@gmx.net>

 rtl2832.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)


Hans-Frieder Vogt                       e-mail: hfvogt <at> gmx .dot. net
--
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

Thomas Mair July 23, 2012, 7:49 p.m. UTC | #1
On 15.07.2012 19:56, Hans-Frieder Vogt wrote:
> The current formulation of the bw_params loop uses the counter j as an index for the first dimension of the
> bw_params array which is later incremented by the variable i.
> It is evaluated correctly only, because j is initialized to 0 at the beginning of the loop.
> I think that explicitly using the index 0 better reflects the intent of the expression.
You are right. It makes the code more readeable.

> 
> Signed-off-by: Hans-Frieder Vogt <hfvogt@gmx.net>
> 
>  rtl2832.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> --- a/drivers/media/dvb/frontends/rtl2832.c	2012-07-06 05:45:16.000000000 +0200
> +++ b/drivers/media/dvb/frontends/rtl2832.c	2012-07-15 19:05:28.428017449 +0200
> @@ -589,7 +589,7 @@ static int rtl2832_set_frontend(struct d
>  		return -EINVAL;
>  	}
>  
> -	for (j = 0; j < sizeof(bw_params[j]); j++) {
> +	for (j = 0; j < sizeof(bw_params[0]); j++) {
>  		ret = rtl2832_wr_regs(priv, 0x1c+j, 1, &bw_params[i][j], 1);
>  		if (ret)
>  			goto err;
> 
> Hans-Frieder Vogt                       e-mail: hfvogt <at> gmx .dot. net
> 

--
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
diff mbox

Patch

--- a/drivers/media/dvb/frontends/rtl2832.c	2012-07-06 05:45:16.000000000 +0200
+++ b/drivers/media/dvb/frontends/rtl2832.c	2012-07-15 19:05:28.428017449 +0200
@@ -589,7 +589,7 @@  static int rtl2832_set_frontend(struct d
 		return -EINVAL;
 	}
 
-	for (j = 0; j < sizeof(bw_params[j]); j++) {
+	for (j = 0; j < sizeof(bw_params[0]); j++) {
 		ret = rtl2832_wr_regs(priv, 0x1c+j, 1, &bw_params[i][j], 1);
 		if (ret)
 			goto err;