From patchwork Tue Jul 24 08:19:13 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Herrenschmidt X-Patchwork-Id: 1230511 Return-Path: X-Original-To: patchwork-linux-fbdev@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 00DE1DF25A for ; Tue, 24 Jul 2012 08:19:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755645Ab2GXITY (ORCPT ); Tue, 24 Jul 2012 04:19:24 -0400 Received: from gate.crashing.org ([63.228.1.57]:34424 "EHLO gate.crashing.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755688Ab2GXITV (ORCPT ); Tue, 24 Jul 2012 04:19:21 -0400 Received: from [127.0.0.1] (localhost.localdomain [127.0.0.1]) by gate.crashing.org (8.14.1/8.13.8) with ESMTP id q6O8JFkM019165; Tue, 24 Jul 2012 03:19:16 -0500 Message-ID: <1343117953.3715.23.camel@pasglop> Subject: [PATCH] fbdev: Make pixel_to_pat() failure mode more friendly From: Benjamin Herrenschmidt To: linux-fbdev@vger.kernel.org Cc: FlorianSchandinat@gmx.de Date: Tue, 24 Jul 2012 18:19:13 +1000 X-Mailer: Evolution 3.2.3-0ubuntu6 Mime-Version: 1.0 Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org If we accidentally pass an incorrect bpp value to pixel_to_pat(), it panics. This is pretty useless, as we generally have the various console locks held at that point, so nothing will be displayed, and there is no reason to make this a fatal event. Let's WARN instead. Signed-off-by: Benjamin Herrenschmidt --- -- To unsubscribe from this list: send the line "unsubscribe linux-fbdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/video/fb_draw.h b/drivers/video/fb_draw.h index 04c01fa..624ee11 100644 --- a/drivers/video/fb_draw.h +++ b/drivers/video/fb_draw.h @@ -3,6 +3,7 @@ #include #include +#include /* * Compose two values, using a bitmask as decision value @@ -41,7 +42,8 @@ pixel_to_pat( u32 bpp, u32 pixel) case 32: return 0x0000000100000001ul*pixel; default: - panic("pixel_to_pat(): unsupported pixelformat\n"); + WARN(1, "pixel_to_pat(): unsupported pixelformat %d\n", bpp); + return 0; } } #else @@ -66,7 +68,8 @@ pixel_to_pat( u32 bpp, u32 pixel) case 32: return 0x00000001ul*pixel; default: - panic("pixel_to_pat(): unsupported pixelformat\n"); + WARN(1, "pixel_to_pat(): unsupported pixelformat %d\n", bpp); + return 0; } } #endif