From patchwork Mon Jan 19 18:41:01 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: 5660451 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 EDD019F333 for ; Mon, 19 Jan 2015 18:41:27 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 55B9320412 for ; Mon, 19 Jan 2015 18:41:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 711B6203F4 for ; Mon, 19 Jan 2015 18:41:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751947AbbASSlG (ORCPT ); Mon, 19 Jan 2015 13:41:06 -0500 Received: from mout.web.de ([212.227.17.12]:60354 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751617AbbASSlF (ORCPT ); Mon, 19 Jan 2015 13:41:05 -0500 Received: from [192.168.1.2] ([78.48.242.248]) by smtp.web.de (mrweb102) with ESMTPSA (Nemesis) id 0LtWsC-1XlsT41CmS-010seb; Mon, 19 Jan 2015 19:41:02 +0100 Message-ID: <54BD4FBD.3020308@users.sourceforge.net> Date: Mon, 19 Jan 2015 19:41:01 +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 6/9] video: One function call less in pvr2fb_common_init() 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:JpEmSg6DWCx5s22BULGqYWIGznGD4ih4HrTdLU8ewiPIiPU3lMH chwg8aNeVs5apJ7s6MKjrqQ1JEw5M4AKDDQecOQmxdnhJCGP12jgkwNHdXPx3o+N49V0xEd E30fmymKQ1CZLek1GvMZHOQCJtNZvaToyBqXjOwfCKhEdOnfIkMD0dJXonzMpInx4PrPh/n ohXTz2K/m8DIjdohZWSPQ== 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 14:50:44 +0100 The iounmap() function could be called in two cases by the pvr2fb_common_init() 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/pvr2fb.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/video/fbdev/pvr2fb.c b/drivers/video/fbdev/pvr2fb.c index 7aa4ef1..9fb8bbf 100644 --- a/drivers/video/fbdev/pvr2fb.c +++ b/drivers/video/fbdev/pvr2fb.c @@ -773,14 +773,14 @@ static int pvr2fb_common_init(void) if (!fb_info->screen_base) { printk(KERN_ERR "pvr2fb: Failed to remap smem space\n"); - goto out_err; + return -ENXIO; } par->mmio_base = (unsigned long)ioremap_nocache(pvr2_fix.mmio_start, pvr2_fix.mmio_len); if (!par->mmio_base) { printk(KERN_ERR "pvr2fb: Failed to remap mmio space\n"); - goto out_err; + goto io_unmap_screen; } fb_memset(fb_info->screen_base, 0, pvr2_fix.smem_len); @@ -807,7 +807,7 @@ static int pvr2fb_common_init(void) fb_alloc_cmap(&fb_info->cmap, 256, 0); if (register_framebuffer(fb_info) < 0) - goto out_err; + goto io_unmap_mmio; /*Must write PIXDEPTH to register before anything is displayed - so force init */ pvr2_init_display(fb_info); @@ -840,10 +840,10 @@ static int pvr2fb_common_init(void) return 0; -out_err: +io_unmap_mmio: + iounmap((void *)par->mmio_base); +io_unmap_screen: iounmap(fb_info->screen_base); - if (par->mmio_base) - iounmap((void *)par->mmio_base); return -ENXIO; }