From: Tommi Rantala Date: Fri, 9 Nov 2012 09:19:36 +0000 (+0000) Subject: drm/mgag200: check alloc_apertures() success in mga_vram_init() X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=0a7fdc59fba559dfbce14963b32102125c49cb10;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git drm/mgag200: check alloc_apertures() success in mga_vram_init() Check for alloc_apertures() memory allocation failure, and propagate an error code in case the allocation failed. Signed-off-by: Tommi Rantala Signed-off-by: Dave Airlie --- diff --git a/drivers/gpu/drm/mgag200/mgag200_main.c b/drivers/gpu/drm/mgag200/mgag200_main.c index d6a1aae33701..07d4b24d4fff 100644 --- a/drivers/gpu/drm/mgag200/mgag200_main.c +++ b/drivers/gpu/drm/mgag200/mgag200_main.c @@ -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);