From patchwork Sun Nov 5 14:43:05 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SF Markus Elfring X-Patchwork-Id: 10042257 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 3E76560247 for ; Sun, 5 Nov 2017 14:43:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2803129212 for ; Sun, 5 Nov 2017 14:43:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1C6AF29455; Sun, 5 Nov 2017 14:43:32 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id BB80229212 for ; Sun, 5 Nov 2017 14:43:31 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 244FF6E031; Sun, 5 Nov 2017 14:43:30 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mout.web.de (mout.web.de [212.227.15.4]) by gabe.freedesktop.org (Postfix) with ESMTPS id A40726E031 for ; Sun, 5 Nov 2017 14:43:27 +0000 (UTC) Received: from [192.168.1.3] ([92.227.245.53]) by smtp.web.de (mrweb001 [213.165.67.108]) with ESMTPSA (Nemesis) id 0MNc1S-1e4ELH3gdO-0079Rb; Sun, 05 Nov 2017 15:43:17 +0100 To: linux-fbdev@vger.kernel.org, dri-devel@lists.freedesktop.org, Bartlomiej Zolnierkiewicz From: SF Markus Elfring Subject: [PATCH] video/fbdev/dnfb: Use common error handling code in dnfb_probe() Message-ID: Date: Sun, 5 Nov 2017 15:43:05 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 Content-Language: en-GB X-Provags-ID: V03:K0:B2zMcGKBQli0KDD+camiUW+0h/JTHsVQoRxDyO22ma6GVvnvJfK Y/GAuvVGAcC0LFtqeLmJVfuuQFG4OHugc2Egs1FIHZMFfu0vOqEp5ZbFQMtwlAJcFiEkVib sdVBwop6RtbGOk0jGiHn0WVKYBcAPOz6wUNqLh9rIlcI4toUbxfZByZrOfUUMv9VUjf2e1r 5l/SHjhNdHuehPDEdMYRw== X-UI-Out-Filterresults: notjunk:1; V01:K0:rf3xixBtevM=:9Zsq5GVfMlC3QUZSDpPaWs P93airycFPNml2BPwroaAJnmbYhF7N5kG2bGIQb8sPNTHgZmWiYX5lwj+zoTo6vrlxS+Yv9k3 Q0XQOEQ98HVP4xqZFJw2lyyKrBBoYlqTnouyjk57aMx7kJJK/fd0qevkz1xirhScO2LikkUwc 9a2AWXfIRQjvYpTgGe9Sgk2d2E+f+MNrkdy9yFuXKf25o4951xW7WGEy+y/t9xJAMSNX6qEqB s+0kx+dbBOyPRJY1/Z/DE2wCqvoyDSmPdOAKx84gXUtytyroySFsqXDp8EubatOTxUdJCwJDN J8UNWSHV3mSyl+f0ZZnGVSMcmNEvSk8d/8gvsmduHKqiX38grsaPb532AZszztG9AxpJrLEeq e2liFEg2Lc+rPZiM/SEEFSbgBjV/8yQlXreZxjdJ4LixK1a/QeOsmbcNcTjbH5nGP2T/xQw22 TOM7dy3u7qferSuw58qcVN7YJAjbjuTEJz//ygzT315b7kDaZO20Llis6+TG2JT7wVPxh5wcC 3dVRhxQyfwAKs8cfuMJ0u+CRiCGZ1rVB87xIYtwZSS/GX/iZZmoR7HnwwRI+OBYrZXo28wDgI Ez1NNS+fmBgmXCVVW3xWhb70Qzh3n1APjnIAtMRqhAqlsP0ukQ6oYDusPes9uRgtv4QOghPM6 tkXDQgk9lPs28mrxzvHRk3uDa0v3rIWDOtfRuB3AooVyOmycf01/I8Qy/DlDhn4pG4+tv1gwS xSCu9e/cZboDfweTCKTMzRpAhZOY/G1dLqzkIzlB1JP72vJ5tCzqXKd47EViRC9GZ3idTdiqG x/mIevmQLzFhPtdn8atGTb8piwq3EPxpPei5VuxRbHMwa9l40Q= Cc: kernel-janitors@vger.kernel.org, LKML X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Markus Elfring Date: Sun, 5 Nov 2017 14:54:52 +0100 Add a jump target so that a bit of exception handling can be better reused at the end of this function. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring --- drivers/video/fbdev/dnfb.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/video/fbdev/dnfb.c b/drivers/video/fbdev/dnfb.c index 09415009d797..5505fa00c634 100644 --- a/drivers/video/fbdev/dnfb.c +++ b/drivers/video/fbdev/dnfb.c @@ -242,16 +242,13 @@ static int dnfb_probe(struct platform_device *dev) info->screen_base = (u_char *) info->fix.smem_start; err = fb_alloc_cmap(&info->cmap, 2, 0); - if (err < 0) { - framebuffer_release(info); - return err; - } + if (err < 0) + goto release_framebuffer; err = register_framebuffer(info); if (err < 0) { fb_dealloc_cmap(&info->cmap); - framebuffer_release(info); - return err; + goto release_framebuffer; } platform_set_drvdata(dev, info); @@ -265,6 +262,10 @@ static int dnfb_probe(struct platform_device *dev) printk("apollo frame buffer alive and kicking !\n"); return err; + +release_framebuffer: + framebuffer_release(info); + return err; } static struct platform_driver dnfb_driver = {