rtl2832.c: minor cleanup
PATCH 1/1 rtl2832.c: minor cleanup
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.
rtl2832.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/dvb/frontends/rtl2832.c +1 -1
@@ -589,7 +589,7 @@ static int rtl2832_set_frontend(struct dreturn -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
Quoted 4 lines · Hans-Frieder Vogt
The current formulation of the
bw_paramsloop uses the counter j as an index for the first dimension of thebw_paramsarray 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.
Quoted 20 lines
Signed-off-by Hans-Frieder Vogt <[email protected]>rtl2832.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/media/dvb/frontends/rtl2832.c +1
-1@@ -589,7 +589,7 @@ static int rtl2832_set_frontend(struct dreturn -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