aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/nouveau/nouveau_bios.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm/nouveau/nouveau_bios.c')
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_bios.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/gpu/drm/nouveau/nouveau_bios.c b/drivers/gpu/drm/nouveau/nouveau_bios.c
index 637afe71de56..80963d05b54a 100644
--- a/drivers/gpu/drm/nouveau/nouveau_bios.c
+++ b/drivers/gpu/drm/nouveau/nouveau_bios.c
@@ -177,14 +177,15 @@ bios_shadow_pci(struct nvbios *bios)
177 177
178 if (!pci_enable_rom(pdev)) { 178 if (!pci_enable_rom(pdev)) {
179 void __iomem *rom = pci_map_rom(pdev, &length); 179 void __iomem *rom = pci_map_rom(pdev, &length);
180 if (rom) { 180 if (rom && length) {
181 bios->data = kmalloc(length, GFP_KERNEL); 181 bios->data = kmalloc(length, GFP_KERNEL);
182 if (bios->data) { 182 if (bios->data) {
183 memcpy_fromio(bios->data, rom, length); 183 memcpy_fromio(bios->data, rom, length);
184 bios->length = length; 184 bios->length = length;
185 } 185 }
186 pci_unmap_rom(pdev, rom);
187 } 186 }
187 if (rom)
188 pci_unmap_rom(pdev, rom);
188 189
189 pci_disable_rom(pdev); 190 pci_disable_rom(pdev);
190 } 191 }