mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2025-01-27 19:52:11 +07:00
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>
This commit is contained in:
parent
f423b9a86a
commit
57747b7f25
@ -2970,20 +2970,20 @@ void __devinit bttv_idcard(struct bttv *btv)
|
|||||||
|
|
||||||
if (UNSET != audiomux[0]) {
|
if (UNSET != audiomux[0]) {
|
||||||
gpiobits = 0;
|
gpiobits = 0;
|
||||||
for (i = 0; i < 4; i++) {
|
for (i = 0; i < ARRAY_SIZE(bttv_tvcards->gpiomux); i++) {
|
||||||
bttv_tvcards[btv->c.type].gpiomux[i] = audiomux[i];
|
bttv_tvcards[btv->c.type].gpiomux[i] = audiomux[i];
|
||||||
gpiobits |= audiomux[i];
|
gpiobits |= audiomux[i];
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
gpiobits = audioall;
|
gpiobits = audioall;
|
||||||
for (i = 0; i < 4; i++) {
|
for (i = 0; i < ARRAY_SIZE(bttv_tvcards->gpiomux); i++) {
|
||||||
bttv_tvcards[btv->c.type].gpiomux[i] = audioall;
|
bttv_tvcards[btv->c.type].gpiomux[i] = audioall;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
bttv_tvcards[btv->c.type].gpiomask = (UNSET != gpiomask) ? gpiomask : gpiobits;
|
bttv_tvcards[btv->c.type].gpiomask = (UNSET != gpiomask) ? gpiomask : gpiobits;
|
||||||
printk(KERN_INFO "bttv%d: gpio config override: mask=0x%x, mux=",
|
printk(KERN_INFO "bttv%d: gpio config override: mask=0x%x, mux=",
|
||||||
btv->c.nr,bttv_tvcards[btv->c.type].gpiomask);
|
btv->c.nr,bttv_tvcards[btv->c.type].gpiomask);
|
||||||
for (i = 0; i < 5; i++) {
|
for (i = 0; i < ARRAY_SIZE(bttv_tvcards->gpiomux); i++) {
|
||||||
printk("%s0x%x", i ? "," : "", bttv_tvcards[btv->c.type].gpiomux[i]);
|
printk("%s0x%x", i ? "," : "", bttv_tvcards[btv->c.type].gpiomux[i]);
|
||||||
}
|
}
|
||||||
printk("\n");
|
printk("\n");
|
||||||
|
Loading…
Reference in New Issue
Block a user