drm/mgag200: check alloc_apertures() success in mga_vram_init()
authorTommi Rantala <tt.rantala@gmail.com>
Fri, 9 Nov 2012 09:19:36 +0000 (09:19 +0000)
committerDave Airlie <airlied@redhat.com>
Tue, 20 Nov 2012 06:06:24 +0000 (16:06 +1000)
Check for alloc_apertures() memory allocation failure, and propagate an
error code in case the allocation failed.

Signed-off-by: Tommi Rantala <tt.rantala@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
drivers/gpu/drm/mgag200/mgag200_main.c

index d6a1aae337012aec10d27ec1a42d52ff5111868e..07d4b24d4fff283fa17acdc607391d72f2b24e3b 100644 (file)
@@ -133,6 +133,8 @@ static int mga_vram_init(struct mga_device *mdev)
 {
        void __iomem *mem;
        struct apertures_struct *aper = alloc_apertures(1);
+       if (!aper)
+               return -ENOMEM;
 
        /* BAR 0 is VRAM */
        mdev->mc.vram_base = pci_resource_start(mdev->dev->pdev, 0);