From patchwork Sat May 21 19:42:55 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geert Uytterhoeven X-Patchwork-Id: 806122 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter2.kernel.org (8.14.4/8.14.3) with ESMTP id p4LJh3v1017363 for ; Sat, 21 May 2011 19:43:03 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757230Ab1EUTnC (ORCPT ); Sat, 21 May 2011 15:43:02 -0400 Received: from juliette.telenet-ops.be ([195.130.137.74]:48845 "EHLO juliette.telenet-ops.be" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757274Ab1EUTnB (ORCPT ); Sat, 21 May 2011 15:43:01 -0400 Received: from ayla.of.borg ([84.193.80.148]) by juliette.telenet-ops.be with bizsmtp id mKiz1g0053C005g06Kiza3; Sat, 21 May 2011 21:43:00 +0200 Received: from geert by ayla.of.borg with local (Exim 4.71) (envelope-from ) id 1QNs4h-0008MY-DM; Sat, 21 May 2011 21:42:59 +0200 From: Geert Uytterhoeven To: Paul Mundt Cc: linux-fbdev@vger.kernel.org, linux-m68k@vger.kernel.org, Geert Uytterhoeven Subject: [PATCH 2/3] fbdev/amifb: Do not call panic() if there's not enough Chip RAM Date: Sat, 21 May 2011 21:42:55 +0200 Message-Id: <1306006976-32117-2-git-send-email-geert@linux-m68k.org> X-Mailer: git-send-email 1.7.0.4 In-Reply-To: <1306006976-32117-1-git-send-email-geert@linux-m68k.org> References: <1306006976-32117-1-git-send-email-geert@linux-m68k.org> Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter2.kernel.org [140.211.167.43]); Sat, 21 May 2011 19:43:03 +0000 (UTC) Fail gracefully instead. Signed-off-by: Geert Uytterhoeven --- drivers/video/amifb.c | 10 ++++++++-- 1 files changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/video/amifb.c b/drivers/video/amifb.c index 603f84f..1b0185c 100644 --- a/drivers/video/amifb.c +++ b/drivers/video/amifb.c @@ -2230,8 +2230,10 @@ static inline u_long __init chipalloc(u_long size) { size += PAGE_SIZE-1; if (!(unaligned_chipptr = (u_long)amiga_chip_alloc(size, - "amifb [RAM]"))) - panic("No Chip RAM for frame buffer"); + "amifb [RAM]"))) { + pr_err("amifb: No Chip RAM for frame buffer"); + return 0; + } memset((void *)unaligned_chipptr, 0, size); return PAGE_ALIGN(unaligned_chipptr); } @@ -2385,6 +2387,10 @@ default_chipset: DUMMYSPRITEMEMSIZE+ COPINITSIZE+ 4*COPLISTSIZE); + if (!chipptr) { + err = -ENOMEM; + goto amifb_error; + } assignchunk(videomemory, u_long, chipptr, fb_info.fix.smem_len); assignchunk(spritememory, u_long, chipptr, SPRITEMEMSIZE);