From patchwork Fri Nov 3 09:54:38 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: 10039751 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 8F6196037D for ; Fri, 3 Nov 2017 09:55:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 966E029580 for ; Fri, 3 Nov 2017 09:55:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 876862958A; Fri, 3 Nov 2017 09:55:08 +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=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4032929580 for ; Fri, 3 Nov 2017 09:55:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753876AbdKCJyv (ORCPT ); Fri, 3 Nov 2017 05:54:51 -0400 Received: from mout.web.de ([212.227.15.4]:62160 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750883AbdKCJyu (ORCPT ); Fri, 3 Nov 2017 05:54:50 -0400 Received: from [192.168.1.3] ([78.49.7.122]) by smtp.web.de (mrweb003 [213.165.67.108]) with ESMTPSA (Nemesis) id 0MLgTT-1eBO1y2dMZ-000qqP; Fri, 03 Nov 2017 10:54:41 +0100 To: devel@driverdev.osuosl.org, linux-media@vger.kernel.org, Derek Robson , Greg Kroah-Hartman , Mauro Carvalho Chehab , Simran Singhal Cc: LKML , kernel-janitors@vger.kernel.org From: SF Markus Elfring Subject: [PATCH] staging/media/davinci_vpfe: Use common error handling code in vpfe_attach_irq() Message-ID: <47780e02-1fcd-dfc7-c7d7-65d32f6652e4@users.sourceforge.net> Date: Fri, 3 Nov 2017 10:54:38 +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:/AmrXX7r5m/f1wACGbNpYe/06eaLfJCBdH0XUzyS0KGxoc/K44Y 8HVshgdIGABC+bkoi5sF6zxtg28P8ea/ayWUHcGQK+387tc24YA8iUYj0vWjsyrlvbXPSHG OTCOKzMoOXM5P5HULE9zPbboo7eL0wKwWfVKA4kqeNje9Kd4tVvi2LcIqUfOa9FjUdXzBHR bpaX8e7pVUk9A/nXSUy7g== X-UI-Out-Filterresults: notjunk:1; V01:K0:RFXohf/DX7o=:pClNEBaRpsv5C2/kEaUsrT RZa1kvafu4fBoPd0220e3PjFpHm1AUNobBH6j6cRrVYDrgmw3u3KxtER5pvlOTVpg/oqGla53 gFrawrXCdb/o80DcZF02kH1t3vBGJIoyj86Mb4rjyFR33bziFA5yADEH0E5CK8h8deMefZOQY czeWNKHEKZoXc5Qn8rvzxFAhurVV9Bqd9Epavttd/NH//aC9wjIxYc0GYHk7vRwbAVnm4nzxW pn1buvzqjm3XNpYHWa1EI6XyeDEWrwto/qSO0dxKnkP2S3EonHsjaaNROgsIWXm04OcmnUS7X ftACjVALbTEpcuXKl/XMYefLpRypegxtPL/WRs8l5qNoGBiA6Vv1cY+Xnyoh6RrmFnH2NAFH+ mDXpuRqDTtV4jYtQaxxQANs+IsAsA25s0rL6gVlfxB4qiJPdNZgehjcMRiXDIAVejIMOBAB4m jWuiA6aFH6tdOn3d974lm13maMCOIsGGgPWuqCG/AdDTS7AqSqDveHFHA3OpsgHpmaPlUx+Ew 5ro5sgxc8FC8jEoOOVQFHd1vBeh9P4/fy8wFnoBnOFSVXnNi+KcBvru04O8Iso7xLzcaf/JoY 6e5Am2ajhEr8H67J5HI6llDF2aB2tmi0R2A4DYdHpq/s+mYcfO3pFMxFz9q4Amf4K9dNW+o1w LyMe8Fo7/wXFibUiChS0/lLeTLKkb4RVRcGrk2AtfceIT39P2fVrJCdYOhmoCGrqcboVFp9GG xucfMMFKTNTnMelkixguMEXsuH5D8M/y1NW4cIbCqCGo+ai5tJMD4qeGL4qHEuCv+a90Frklq 2peDlSqtCzs6p7knOOHsNpTaMSie0wB3P7QxCJ6tfBTrpjGBRQ= Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Markus Elfring Date: Fri, 3 Nov 2017 10:45:31 +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/staging/media/davinci_vpfe/vpfe_mc_capture.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/staging/media/davinci_vpfe/vpfe_mc_capture.c b/drivers/staging/media/davinci_vpfe/vpfe_mc_capture.c index bffe2153b910..80297d2df31d 100644 --- a/drivers/staging/media/davinci_vpfe/vpfe_mc_capture.c +++ b/drivers/staging/media/davinci_vpfe/vpfe_mc_capture.c @@ -309,8 +309,7 @@ static int vpfe_attach_irq(struct vpfe_device *vpfe_dev) if (ret < 0) { v4l2_err(&vpfe_dev->v4l2_dev, "Error: requesting VINT1 interrupt\n"); - free_irq(vpfe_dev->ccdc_irq0, vpfe_dev); - return ret; + goto free_irq; } ret = request_irq(vpfe_dev->imp_dma_irq, vpfe_imp_dma_isr, @@ -319,11 +318,14 @@ static int vpfe_attach_irq(struct vpfe_device *vpfe_dev) v4l2_err(&vpfe_dev->v4l2_dev, "Error: requesting IMP IRQ interrupt\n"); free_irq(vpfe_dev->ccdc_irq1, vpfe_dev); - free_irq(vpfe_dev->ccdc_irq0, vpfe_dev); - return ret; + goto free_irq; } return 0; + +free_irq: + free_irq(vpfe_dev->ccdc_irq0, vpfe_dev); + return ret; } /*