From 0a7fdc59fba559dfbce14963b32102125c49cb10 Mon Sep 17 00:00:00 2001 From: Tommi Rantala Date: Fri, 9 Nov 2012 09:19:36 +0000 Subject: 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 --- drivers/gpu/drm/mgag200/mgag200_main.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'drivers/gpu/drm/mgag200') 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); -- cgit v1.2.3