* [PATCH] rtl2832.c: minor cleanup
@ 2012-07-15 17:56 Hans-Frieder Vogt
2012-07-23 19:49 ` Thomas Mair
0 siblings, 1 reply; 2+ messages in thread
From: Hans-Frieder Vogt @ 2012-07-15 17:56 UTC (permalink / raw)
To: linux-media, thomas.mair86
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(-)
--- 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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] rtl2832.c: minor cleanup
2012-07-15 17:56 [PATCH] rtl2832.c: minor cleanup Hans-Frieder Vogt
@ 2012-07-23 19:49 ` Thomas Mair
0 siblings, 0 replies; 2+ messages in thread
From: Thomas Mair @ 2012-07-23 19:49 UTC (permalink / raw)
To: Hans-Frieder Vogt; +Cc: linux-media, thomas.mair86
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
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-07-23 19:49 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-15 17:56 [PATCH] rtl2832.c: minor cleanup Hans-Frieder Vogt
2012-07-23 19:49 ` Thomas Mair
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).