From patchwork Sat May 23 17:32:35 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 6470601 Return-Path: X-Original-To: patchwork-linux-fbdev@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 87DF99F399 for ; Sat, 23 May 2015 17:35:33 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id CB53920551 for ; Sat, 23 May 2015 17:35:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id EBABA20411 for ; Sat, 23 May 2015 17:35:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758086AbbEWRfZ (ORCPT ); Sat, 23 May 2015 13:35:25 -0400 Received: from userp1040.oracle.com ([156.151.31.81]:48982 "EHLO userp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758024AbbEWRfY (ORCPT ); Sat, 23 May 2015 13:35:24 -0400 Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234]) by userp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id t4NHWgXx004702 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Sat, 23 May 2015 17:32:43 GMT Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by aserv0022.oracle.com (8.13.8/8.13.8) with ESMTP id t4NHWfnG007942 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL); Sat, 23 May 2015 17:32:42 GMT Received: from abhmp0018.oracle.com (abhmp0018.oracle.com [141.146.116.24]) by aserv0121.oracle.com (8.13.8/8.13.8) with ESMTP id t4NHWfsa024964; Sat, 23 May 2015 17:32:41 GMT Received: from mwanda (/154.0.139.178) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Sat, 23 May 2015 10:32:41 -0700 Date: Sat, 23 May 2015 20:32:35 +0300 From: Dan Carpenter To: Jean-Christophe Plagniol-Villard , Thomas =?iso-8859-1?Q?Niederpr=FCm?= Cc: Tomi Valkeinen , Maxime Ripard , Prabhakar Lad , linux-fbdev@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [patch] fbdev: ssd1307fb: potential ERR_PTR dereference Message-ID: <20150523173235.GA31595@mwanda> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.23 (2014-03-12) X-Source-IP: aserv0022.oracle.com [141.146.126.234] Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable 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 The error handling got shifted down a few lines from where it was supposed to be for some reason. Fixes: a14a7ba8cb0f ('fbdev: ssd1307fb: add backlight controls for setting the contrast') Signed-off-by: Dan Carpenter Acked-by: Maxime Ripard --- 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/fbdev/ssd1307fb.c b/drivers/video/fbdev/ssd1307fb.c index 8fc224c..9c28a77 100644 --- a/drivers/video/fbdev/ssd1307fb.c +++ b/drivers/video/fbdev/ssd1307fb.c @@ -655,15 +655,16 @@ static int ssd1307fb_probe(struct i2c_client *client, snprintf(bl_name, sizeof(bl_name), "ssd1307fb%d", info->node); bl = backlight_device_register(bl_name, &client->dev, par, &ssd1307fb_bl_ops, NULL); - bl->props.brightness = par->contrast; - bl->props.max_brightness = MAX_CONTRAST; - info->bl_dev = bl; - if (IS_ERR(bl)) { dev_err(&client->dev, "unable to register backlight device: %ld\n", PTR_ERR(bl)); goto bl_init_error; } + + bl->props.brightness = par->contrast; + bl->props.max_brightness = MAX_CONTRAST; + info->bl_dev = bl; + dev_info(&client->dev, "fb%d: %s framebuffer device registered, using %d bytes of video memory\n", info->node, info->fix.id, vmem_size); return 0;