From patchwork Mon Jan 19 18:30:42 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SF Markus Elfring X-Patchwork-Id: 5660381 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 381279F358 for ; Mon, 19 Jan 2015 18:30:51 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6777520412 for ; Mon, 19 Jan 2015 18:30:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0A28F2041C for ; Mon, 19 Jan 2015 18:30:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751529AbbASSas (ORCPT ); Mon, 19 Jan 2015 13:30:48 -0500 Received: from mout.web.de ([212.227.17.12]:62350 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751248AbbASSar (ORCPT ); Mon, 19 Jan 2015 13:30:47 -0500 Received: from [192.168.1.2] ([78.48.242.248]) by smtp.web.de (mrweb101) with ESMTPSA (Nemesis) id 0LnjFb-1XWnP90G5f-00hxTa; Mon, 19 Jan 2015 19:30:44 +0100 Message-ID: <54BD4D52.2090902@users.sourceforge.net> Date: Mon, 19 Jan 2015 19:30:42 +0100 From: SF Markus Elfring User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 MIME-Version: 1.0 To: Jean-Christophe Plagniol-Villard , Tomi Valkeinen , linux-fbdev@vger.kernel.org CC: LKML , kernel-janitors@vger.kernel.org, Julia Lawall Subject: [PATCH 3/9] video: One function call less in vesafb_probe() after, error detection References: <5307CAA2.8060406@users.sourceforge.net> <530A086E.8010901@users.sourceforge.net> <530A72AA.3000601@users.sourceforge.net> <530B5FB6.6010207@users.sourceforge.net> <530C5E18.1020800@users.sourceforge.net> <530CD2C4.4050903@users.sourceforge.net> <530CF8FF.8080600@users.sourceforge.net> <530DD06F.4090703@users.sourceforge.net> <5317A59D.4@users.sourceforge.net> <54BD44F0.3040705@users.sourceforge.net> In-Reply-To: <54BD44F0.3040705@users.sourceforge.net> X-Provags-ID: V03:K0:pbWTDFgv2gpfqmMuw/HlXFSMCuPcXn5AkeJ2uTTyh/wkpjufH3R 36LUeaiyvfTN5M1Lx5WYwQg0h6TSKie5gNfWf6LFrax6ES7FroF4sqmmIHO4tSUYSX6VuRf 55b/J21ArY1l6QKVScco9U/xD/Z5oQoMe+8nNJK/8iv51qwiDBwce2/3hos2eVgOqTu1TIr g3stOMij6zS0x9VlV2yng== X-UI-Out-Filterresults: notjunk:1; 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=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 From: Markus Elfring Date: Mon, 19 Jan 2015 11:30:33 +0100 The iounmap() function could be called in two cases by the vesafb_probe() function during error handling even if the passed data structure element contained still a null pointer. This implementation detail could be improved by adjustments for jump labels. Signed-off-by: Markus Elfring --- drivers/video/fbdev/vesafb.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/video/fbdev/vesafb.c b/drivers/video/fbdev/vesafb.c index 693d18e..de7cad0 100644 --- a/drivers/video/fbdev/vesafb.c +++ b/drivers/video/fbdev/vesafb.c @@ -303,7 +303,7 @@ static int vesafb_probe(struct platform_device *dev) info->apertures = alloc_apertures(1); if (!info->apertures) { err = -ENOMEM; - goto err; + goto release_framebuffer; } info->apertures->ranges[0].base = screen_info.lfb_base; info->apertures->ranges[0].size = size_total; @@ -462,7 +462,7 @@ static int vesafb_probe(struct platform_device *dev) "vesafb: abort, cannot ioremap video memory 0x%x @ 0x%lx\n", vesafb_fix.smem_len, vesafb_fix.smem_start); err = -EIO; - goto err; + goto release_framebuffer; } printk(KERN_INFO "vesafb: framebuffer at 0x%lx, mapped to 0x%p, " @@ -492,6 +492,7 @@ static int vesafb_probe(struct platform_device *dev) return 0; err: iounmap(info->screen_base); +release_framebuffer: framebuffer_release(info); release_mem_region(vesafb_fix.smem_start, size_total); return err;