diff options
author | Mauro Carvalho Chehab <mchehab@infradead.org> | 2007-03-28 21:37:20 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2007-04-27 14:45:09 -0400 |
commit | 57747b7f2517524aed5f0c5b744badf9da94a91b (patch) | |
tree | 7dc1eae94ad03e49f1029427771d4fb5ad1969ae /drivers/media/video/bt8xx/bttv-cards.c | |
parent | f423b9a86a6dd3d2bc08d78f4d21525a14c40a6b (diff) |
V4L/DVB (5476): Fix gpiomux array size
there were several "magic" for loops, addressing gpiomux array size (4).
Adrian Bunk showed that one of the loops were wrong, going from 0 to 4.
This patch provides the right fix for this trouble, by using ARRAY_SIZE
on all places where we have a for loop using gpiomux.
Thanks to: Adrian Bunk <bunk@stusta.de> for pointing me about this trouble.
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/video/bt8xx/bttv-cards.c')
-rw-r--r-- | drivers/media/video/bt8xx/bttv-cards.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/media/video/bt8xx/bttv-cards.c b/drivers/media/video/bt8xx/bttv-cards.c index 6addc42df045..3d00d50d9cb9 100644 --- a/drivers/media/video/bt8xx/bttv-cards.c +++ b/drivers/media/video/bt8xx/bttv-cards.c | |||
@@ -2970,20 +2970,20 @@ void __devinit bttv_idcard(struct bttv *btv) | |||
2970 | 2970 | ||
2971 | if (UNSET != audiomux[0]) { | 2971 | if (UNSET != audiomux[0]) { |
2972 | gpiobits = 0; | 2972 | gpiobits = 0; |
2973 | for (i = 0; i < 4; i++) { | 2973 | for (i = 0; i < ARRAY_SIZE(bttv_tvcards->gpiomux); i++) { |
2974 | bttv_tvcards[btv->c.type].gpiomux[i] = audiomux[i]; | 2974 | bttv_tvcards[btv->c.type].gpiomux[i] = audiomux[i]; |
2975 | gpiobits |= audiomux[i]; | 2975 | gpiobits |= audiomux[i]; |
2976 | } | 2976 | } |
2977 | } else { | 2977 | } else { |
2978 | gpiobits = audioall; | 2978 | gpiobits = audioall; |
2979 | for (i = 0; i < 4; i++) { | 2979 | for (i = 0; i < ARRAY_SIZE(bttv_tvcards->gpiomux); i++) { |
2980 | bttv_tvcards[btv->c.type].gpiomux[i] = audioall; | 2980 | bttv_tvcards[btv->c.type].gpiomux[i] = audioall; |
2981 | } | 2981 | } |
2982 | } | 2982 | } |
2983 | bttv_tvcards[btv->c.type].gpiomask = (UNSET != gpiomask) ? gpiomask : gpiobits; | 2983 | bttv_tvcards[btv->c.type].gpiomask = (UNSET != gpiomask) ? gpiomask : gpiobits; |
2984 | printk(KERN_INFO "bttv%d: gpio config override: mask=0x%x, mux=", | 2984 | printk(KERN_INFO "bttv%d: gpio config override: mask=0x%x, mux=", |
2985 | btv->c.nr,bttv_tvcards[btv->c.type].gpiomask); | 2985 | btv->c.nr,bttv_tvcards[btv->c.type].gpiomask); |
2986 | for (i = 0; i < 5; i++) { | 2986 | for (i = 0; i < ARRAY_SIZE(bttv_tvcards->gpiomux); i++) { |
2987 | printk("%s0x%x", i ? "," : "", bttv_tvcards[btv->c.type].gpiomux[i]); | 2987 | printk("%s0x%x", i ? "," : "", bttv_tvcards[btv->c.type].gpiomux[i]); |
2988 | } | 2988 | } |
2989 | printk("\n"); | 2989 | printk("\n"); |