]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
drm/nouveau/bar/gf100: ensure BAR is mapped
authorJon Derrick <jonathan.derrick@intel.com>
Sat, 16 Mar 2019 00:05:17 +0000 (18:05 -0600)
committerBen Skeggs <bskeggs@redhat.com>
Wed, 1 May 2019 01:08:39 +0000 (11:08 +1000)
If the BAR is zero size, it indicates it was never successfully mapped.
Ensure that the BAR is valid during initialization before attempting to
use it.

Signed-off-by: Jon Derrick <jonathan.derrick@intel.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
drivers/gpu/drm/nouveau/nvkm/subdev/bar/gf100.c

index a3ba7f50198be90ed7357a7c26f3ddb01a3c3955..a3dcb09a40ee374747901bfdd07c33a6859ad9b1 100644 (file)
@@ -94,6 +94,8 @@ gf100_bar_oneinit_bar(struct gf100_bar *bar, struct gf100_barN *bar_vm,
                return ret;
 
        bar_len = device->func->resource_size(device, bar_nr);
+       if (!bar_len)
+               return -ENOMEM;
        if (bar_nr == 3 && bar->bar2_halve)
                bar_len >>= 1;