From patchwork Fri Nov 9 09:19:36 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tommi Rantala X-Patchwork-Id: 1719761 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by patchwork1.kernel.org (Postfix) with ESMTP id 308BE3FCF7 for ; Fri, 9 Nov 2012 09:27:18 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 034ADA0C21 for ; Fri, 9 Nov 2012 01:27:18 -0800 (PST) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org 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) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; bh=xT/hBiDdqSM1hS2nDBAFcdySBTYhoICQSJX9dg5QRYE=; b=WRl6Ot5Qkxd/M3xdodLX/5x1GjT7oGMFSXDZD0YUEGunIs1l7UVok3LJO3G0+j8arM yKhVdqmzsRP6J04XaxCmfClY6YHHxhPnxi8i8Wa71feiIuXvOaSccw5uZcglZCNRExVF v0YAH5WulJg7GPgumb2qrXYZSmxW5v0Gf1kxKdTRB6s+SSNLfWvv8biH5m/9Bwv7/p7j ZAvclLvUHKv33D5jEHWKUKz/QS9fL1naGIGypjaoHa5J1FR1K+l2GQIJqSfMvPlGRa4T cYFhQD5EaNDlR7bM4wj1T7if0YDaRT1z+FLpcwIn4a4IH0mqt/2W/B/sbSNrMO0hibM7 PACQ== Received: by 10.180.84.41 with SMTP id v9mr1522814wiy.8.1352453069393; Fri, 09 Nov 2012 01:24:29 -0800 (PST) Received: from localhost.localdomain (espcolo-webproxy02.nokia.com. [192.100.120.42]) by mx.google.com with ESMTPS id r10sm1560293wiz.0.2012.11.09.01.24.28 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 09 Nov 2012 01:24:28 -0800 (PST) From: Tommi Rantala To: David Airlie , dri-devel@lists.freedesktop.org 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> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1352452780-2029-1-git-send-email-tt.rantala@gmail.com> References: <1352452780-2029-1-git-send-email-tt.rantala@gmail.com> X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org Errors-To: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@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);