Skip to content

Commit

Permalink
drm/nouveau/bios: check that fixed tvdac gpio data is valid before us…
Browse files Browse the repository at this point in the history
…ing it

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
  • Loading branch information
Ben Skeggs committed Oct 3, 2012
1 parent da07e52 commit acac7bd
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions drivers/gpu/drm/nouveau/core/subdev/bios/gpio.c
Original file line number Diff line number Diff line change
Expand Up @@ -100,13 +100,17 @@ dcb_gpio_parse(struct nouveau_bios *bios, int idx, u8 func, u8 line,
/* DCB 2.2, fixed TVDAC GPIO data */
if ((entry = dcb_table(bios, &ver, &hdr, &cnt, &len)) && ver >= 0x22) {
if (func == DCB_GPIO_TVDAC0) {
*gpio = (struct dcb_gpio_func) {
.func = DCB_GPIO_TVDAC0,
.line = nv_ro08(bios, entry - 4) >> 4,
.log[0] = !!(nv_ro08(bios, entry - 5) & 2),
.log[1] = !(nv_ro08(bios, entry - 5) & 2),
};
return 0;
u8 conf = nv_ro08(bios, entry - 5);
u8 addr = nv_ro08(bios, entry - 4);
if (conf & 0x01) {
*gpio = (struct dcb_gpio_func) {
.func = DCB_GPIO_TVDAC0,
.line = addr >> 4,
.log[0] = !!(conf & 0x02),
.log[1] = !(conf & 0x02),
};
return 0;
}
}
}

Expand Down

0 comments on commit acac7bd

Please sign in to comment.