From patchwork Thu Jun 11 09:24:41 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Heiko Schocher X-Patchwork-Id: 6586791 Return-Path: X-Original-To: patchwork-linux-fbdev@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 8B3B4C0020 for ; Thu, 11 Jun 2015 09:24:50 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9FBFA20600 for ; Thu, 11 Jun 2015 09:24:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3F30F205F9 for ; Thu, 11 Jun 2015 09:24:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752368AbbFKJYr (ORCPT ); Thu, 11 Jun 2015 05:24:47 -0400 Received: from mail-out.m-online.net ([212.18.0.9]:53930 "EHLO mail-out.m-online.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752096AbbFKJYp (ORCPT ); Thu, 11 Jun 2015 05:24:45 -0400 Received: from frontend01.mail.m-online.net (unknown [192.168.8.182]) by mail-out.m-online.net (Postfix) with ESMTP id 3m6fsR3nnpz3hjWh; Thu, 11 Jun 2015 11:24:43 +0200 (CEST) Received: from localhost (dynscan1.mnet-online.de [192.168.6.68]) by mail.m-online.net (Postfix) with ESMTP id 3m6fsR3G7DzvjDd; Thu, 11 Jun 2015 11:24:43 +0200 (CEST) X-Virus-Scanned: amavisd-new at mnet-online.de Received: from mail.mnet-online.de ([192.168.8.182]) by localhost (dynscan1.mail.m-online.net [192.168.6.68]) (amavisd-new, port 10024) with ESMTP id M0IH8csfdAwT; Thu, 11 Jun 2015 11:24:42 +0200 (CEST) X-Auth-Info: dZR0KauR1yixu42zXsd8TI8zepd0F3kALHrvpFTOXCg= Received: from [192.168.0.110] (87.97.46.71.pool.invitel.hu [87.97.46.71]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by mail.mnet-online.de (Postfix) with ESMTPSA; Thu, 11 Jun 2015 11:24:42 +0200 (CEST) Message-ID: <557953D9.6080202@denx.de> Date: Thu, 11 Jun 2015 11:24:41 +0200 From: Heiko Schocher Reply-To: hs@denx.de Organization: DENX Software Engineering User-Agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130329 Thunderbird/17.0.5 MIME-Version: 1.0 To: Dan Carpenter CC: linux-fbdev@vger.kernel.org Subject: Re: video, sm501: add OF binding to support SM501 References: <20150610155132.GK10549@mwanda> In-Reply-To: <20150610155132.GK10549@mwanda> Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org X-Spam-Status: No, score=-3.9 required=5.0 tests=BAYES_00,BIGNUM_EMAILS, RCVD_IN_DNSWL_HI,T_RP_MATCHES_RCVD,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Hello Dan, Am 10.06.2015 17:51, schrieb Dan Carpenter: > Hello Heiko Schocher, > > The patch 4295f9bf74a8: "video, sm501: add OF binding to support > SM501" from Jan 26, 2011, leads to the following static checker > warning: > > drivers/video/fbdev/sm501fb.c:1958 sm501fb_probe() > warn: strcpy() 'cp' of unknown size might be too large for 'fb_mode' > > drivers/video/fbdev/sm501fb.c > 46 static char *fb_mode = "640x480-16@60"; > > [ snip ] > > 1953 info->pdata = &sm501fb_def_pdata; > 1954 if (np) { > 1955 /* Get EDID */ > 1956 cp = of_get_property(np, "mode", &len); > 1957 if (cp) > 1958 strcpy(fb_mode, cp); > > I don't know anything about this hardware but there might be a mode > longer than "640x480-16@60"? Hmm... I just used it with this resolution, but you are right, the datasheet says "200 MHz DAC support 1280×1024 resolution" ... so, in this case fb_mode would be to short ... I propose such a fix: $ git diff What do you think? If this is OK from your side, I can post this patch "officially" ... bye, Heiko diff --git a/drivers/video/fbdev/sm501fb.c b/drivers/video/fbdev/sm501fb.c index 9e74e8f..2e57f2e 100644 --- a/drivers/video/fbdev/sm501fb.c +++ b/drivers/video/fbdev/sm501fb.c @@ -43,7 +43,9 @@ #include "edid.h" -static char *fb_mode = "640x480-16@60"; +static char *fb_default_mode = "640x480-16@60"; +static char fb_mode[20]; +static char *fb_mode_cmdline; static unsigned long default_bpp = 16; static struct fb_videomode sm501_default_mode = { @@ -1963,6 +1965,11 @@ static int sm501fb_probe(struct platform_device *pdev) if (info->edid_data) found = 1; } + } else { + if (fb_mode_cmdline) + strcpy(fb_mode, fb_mode_cmdline); + else + strcpy(fb_mode, fb_default_mode); } #endif if (!found) { @@ -2230,7 +2237,7 @@ static struct platform_driver sm501fb_driver = { module_platform_driver(sm501fb_driver); -module_param_named(mode, fb_mode, charp, 0); +module_param_named(mode, fb_mode_cmdline, charp, 0); MODULE_PARM_DESC(mode, "Specify resolution as \"x[-][@]\" "); module_param_named(bpp, default_bpp, ulong, 0);