linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] m88ts2022: Nested loops shouldn't use the same index variable
@ 2015-03-20 13:37 David Howells
  2015-03-20 14:41 ` Antti Palosaari
  0 siblings, 1 reply; 2+ messages in thread
From: David Howells @ 2015-03-20 13:37 UTC (permalink / raw)
  To: crope; +Cc: dhowells, linux-kernel, linux-media

There are a pair of nested loops inside m88ts2022_cmd() that use the same
index variable, but for different things.  Split the variable.

Signed-off-by: David Howells <dhowells@redhat.com>
---

 drivers/media/tuners/m88ts2022.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/media/tuners/m88ts2022.c b/drivers/media/tuners/m88ts2022.c
index 066e543..cdf9fe5 100644
--- a/drivers/media/tuners/m88ts2022.c
+++ b/drivers/media/tuners/m88ts2022.c
@@ -21,7 +21,7 @@
 static int m88ts2022_cmd(struct m88ts2022_dev *dev, int op, int sleep, u8 reg,
 		u8 mask, u8 val, u8 *reg_val)
 {
-	int ret, i;
+	int ret, i, j;
 	unsigned int utmp;
 	struct m88ts2022_reg_val reg_vals[] = {
 		{0x51, 0x1f - op},
@@ -35,9 +35,9 @@ static int m88ts2022_cmd(struct m88ts2022_dev *dev, int op, int sleep, u8 reg,
 				"i=%d op=%02x reg=%02x mask=%02x val=%02x\n",
 				i, op, reg, mask, val);
 
-		for (i = 0; i < ARRAY_SIZE(reg_vals); i++) {
-			ret = regmap_write(dev->regmap, reg_vals[i].reg,
-					reg_vals[i].val);
+		for (j = 0; j < ARRAY_SIZE(reg_vals); j++) {
+			ret = regmap_write(dev->regmap, reg_vals[j].reg,
+					reg_vals[j].val);
 			if (ret)
 				goto err;
 		}


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

* Re: [PATCH] m88ts2022: Nested loops shouldn't use the same index variable
  2015-03-20 13:37 [PATCH] m88ts2022: Nested loops shouldn't use the same index variable David Howells
@ 2015-03-20 14:41 ` Antti Palosaari
  0 siblings, 0 replies; 2+ messages in thread
From: Antti Palosaari @ 2015-03-20 14:41 UTC (permalink / raw)
  To: David Howells; +Cc: linux-kernel, linux-media

On 03/20/2015 03:37 PM, David Howells wrote:
> There are a pair of nested loops inside m88ts2022_cmd() that use the same
> index variable, but for different things.  Split the variable.
>
> Signed-off-by: David Howells <dhowells@redhat.com>

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

regards
Antti

> ---
>
>   drivers/media/tuners/m88ts2022.c |    8 ++++----
>   1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/media/tuners/m88ts2022.c b/drivers/media/tuners/m88ts2022.c
> index 066e543..cdf9fe5 100644
> --- a/drivers/media/tuners/m88ts2022.c
> +++ b/drivers/media/tuners/m88ts2022.c
> @@ -21,7 +21,7 @@
>   static int m88ts2022_cmd(struct m88ts2022_dev *dev, int op, int sleep, u8 reg,
>   		u8 mask, u8 val, u8 *reg_val)
>   {
> -	int ret, i;
> +	int ret, i, j;
>   	unsigned int utmp;
>   	struct m88ts2022_reg_val reg_vals[] = {
>   		{0x51, 0x1f - op},
> @@ -35,9 +35,9 @@ static int m88ts2022_cmd(struct m88ts2022_dev *dev, int op, int sleep, u8 reg,
>   				"i=%d op=%02x reg=%02x mask=%02x val=%02x\n",
>   				i, op, reg, mask, val);
>
> -		for (i = 0; i < ARRAY_SIZE(reg_vals); i++) {
> -			ret = regmap_write(dev->regmap, reg_vals[i].reg,
> -					reg_vals[i].val);
> +		for (j = 0; j < ARRAY_SIZE(reg_vals); j++) {
> +			ret = regmap_write(dev->regmap, reg_vals[j].reg,
> +					reg_vals[j].val);
>   			if (ret)
>   				goto err;
>   		}
>
> --
> 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
>

-- 
http://palosaari.fi/

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

end of thread, other threads:[~2015-03-20 14:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-20 13:37 [PATCH] m88ts2022: Nested loops shouldn't use the same index variable David Howells
2015-03-20 14:41 ` 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).