diff options
author | Ben Skeggs <bskeggs@redhat.com> | 2016-04-18 20:28:44 -0400 |
---|---|---|
committer | Ben Skeggs <bskeggs@redhat.com> | 2016-05-20 00:43:04 -0400 |
commit | 4d3df19a8e6c9e60eed7f3c6e2025362b3ca2da5 (patch) | |
tree | 0b9bed876b7ca0cdaf930d6d1d7f5d5d25677b79 | |
parent | 2781c928b1b3d5d56d72b4955e19c0d963e2c22e (diff) |
drm/nouveau/bios/pll: check BIT table version before trying to parse it
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
-rw-r--r-- | drivers/gpu/drm/nouveau/nvkm/subdev/bios/pll.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/bios/pll.c b/drivers/gpu/drm/nouveau/nvkm/subdev/bios/pll.c index 4cd3d6502e20..91a7dc56e406 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/bios/pll.c +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/bios/pll.c | |||
@@ -81,9 +81,11 @@ static u16 | |||
81 | pll_limits_table(struct nvkm_bios *bios, u8 *ver, u8 *hdr, u8 *cnt, u8 *len) | 81 | pll_limits_table(struct nvkm_bios *bios, u8 *ver, u8 *hdr, u8 *cnt, u8 *len) |
82 | { | 82 | { |
83 | struct bit_entry bit_C; | 83 | struct bit_entry bit_C; |
84 | u16 data = 0x0000; | ||
84 | 85 | ||
85 | if (!bit_entry(bios, 'C', &bit_C) && bit_C.length >= 10) { | 86 | if (!bit_entry(bios, 'C', &bit_C)) { |
86 | u16 data = nvbios_rd16(bios, bit_C.offset + 8); | 87 | if (bit_C.version == 1 && bit_C.length >= 10) |
88 | data = nvbios_rd16(bios, bit_C.offset + 8); | ||
87 | if (data) { | 89 | if (data) { |
88 | *ver = nvbios_rd08(bios, data + 0); | 90 | *ver = nvbios_rd08(bios, data + 0); |
89 | *hdr = nvbios_rd08(bios, data + 1); | 91 | *hdr = nvbios_rd08(bios, data + 1); |
@@ -94,7 +96,7 @@ pll_limits_table(struct nvkm_bios *bios, u8 *ver, u8 *hdr, u8 *cnt, u8 *len) | |||
94 | } | 96 | } |
95 | 97 | ||
96 | if (bmp_version(bios) >= 0x0524) { | 98 | if (bmp_version(bios) >= 0x0524) { |
97 | u16 data = nvbios_rd16(bios, bios->bmp_offset + 142); | 99 | data = nvbios_rd16(bios, bios->bmp_offset + 142); |
98 | if (data) { | 100 | if (data) { |
99 | *ver = nvbios_rd08(bios, data + 0); | 101 | *ver = nvbios_rd08(bios, data + 0); |
100 | *hdr = 1; | 102 | *hdr = 1; |
@@ -105,7 +107,7 @@ pll_limits_table(struct nvkm_bios *bios, u8 *ver, u8 *hdr, u8 *cnt, u8 *len) | |||
105 | } | 107 | } |
106 | 108 | ||
107 | *ver = 0x00; | 109 | *ver = 0x00; |
108 | return 0x0000; | 110 | return data; |
109 | } | 111 | } |
110 | 112 | ||
111 | static struct pll_mapping * | 113 | static struct pll_mapping * |