From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tommi Rantala Subject: [PATCH 2/6] drm/mgag200: check alloc_apertures() success in mga_vram_init() Date: Fri, 9 Nov 2012 11:19:36 +0200 Message-ID: <1352452780-2029-3-git-send-email-tt.rantala@gmail.com> References: <1352452780-2029-1-git-send-email-tt.rantala@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail-we0-f177.google.com (mail-we0-f177.google.com [74.125.82.177]) by gabe.freedesktop.org (Postfix) with ESMTP id 6A5E6A0B38 for ; Fri, 9 Nov 2012 01:24:30 -0800 (PST) Received: by mail-we0-f177.google.com with SMTP id u50so1600193wey.36 for ; Fri, 09 Nov 2012 01:24:29 -0800 (PST) In-Reply-To: <1352452780-2029-1-git-send-email-tt.rantala@gmail.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dri-devel-bounces+sf-dri-devel=m.gmane.org@lists.freedesktop.org Errors-To: dri-devel-bounces+sf-dri-devel=m.gmane.org@lists.freedesktop.org To: David Airlie , dri-devel@lists.freedesktop.org List-Id: dri-devel@lists.freedesktop.org Check for alloc_apertures() memory allocation failure, and propagate an error code in case the allocation failed. Signed-off-by: Tommi Rantala --- drivers/gpu/drm/mgag200/mgag200_main.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/gpu/drm/mgag200/mgag200_main.c b/drivers/gpu/drm/mgag200/mgag200_main.c index d6a1aae..07d4b24 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); -- 1.7.9.5