aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorBen Skeggs <bskeggs@redhat.com>2012-09-12 15:55:01 +1000
committerBen Skeggs <bskeggs@redhat.com>2012-10-03 13:13:11 +1000
commitacac7bdba61226502a230db9245ca426a67102a9 (patch)
treea712b64eee485bf190709c4d530b771d081c5839 /drivers
parentdrm/nouveau: log channel debug/error messages from client object rather than drm client (diff)
downloadlinux-dev-acac7bdba61226502a230db9245ca426a67102a9.tar.xz
linux-dev-acac7bdba61226502a230db9245ca426a67102a9.zip
drm/nouveau/bios: check that fixed tvdac gpio data is valid before using it
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/bios/gpio.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/drivers/gpu/drm/nouveau/core/subdev/bios/gpio.c b/drivers/gpu/drm/nouveau/core/subdev/bios/gpio.c
index 718267d84c7b..1ae23b328bbd 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/bios/gpio.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/bios/gpio.c
@@ -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;
+ }
}
}