From patchwork Tue Oct 24 16:01:21 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: 10025051 X-Patchwork-Delegate: geert@linux-m68k.org 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 F1E7F6035E for ; Tue, 24 Oct 2017 16:01:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E505928A29 for ; Tue, 24 Oct 2017 16:01:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D9C0228A3A; Tue, 24 Oct 2017 16:01:29 +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=ham 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 8E0A828A29 for ; Tue, 24 Oct 2017 16:01:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751702AbdJXQB3 (ORCPT ); Tue, 24 Oct 2017 12:01:29 -0400 Received: from mout.web.de ([217.72.192.78]:56352 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751682AbdJXQB2 (ORCPT ); Tue, 24 Oct 2017 12:01:28 -0400 Received: from [192.168.1.2] ([92.227.117.134]) by smtp.web.de (mrweb102 [213.165.67.124]) with ESMTPSA (Nemesis) id 0MVcdn-1dgpG12SH1-00Yy1P; Tue, 24 Oct 2017 18:01:22 +0200 Subject: [PATCH 1/2] drm/rcar-du: Use common error handling code in rcar_du_encoders_init() From: SF Markus Elfring To: dri-devel@lists.freedesktop.org, linux-renesas-soc@vger.kernel.org, David Airlie , Laurent Pinchart Cc: LKML , kernel-janitors@vger.kernel.org References: <7d5e68c7-2d64-0131-1a08-eeb4e03cc113@users.sourceforge.net> Message-ID: <9fafa688-f699-c587-ef77-840efa71bf76@users.sourceforge.net> Date: Tue, 24 Oct 2017 18:01:21 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: <7d5e68c7-2d64-0131-1a08-eeb4e03cc113@users.sourceforge.net> Content-Language: en-GB X-Provags-ID: V03:K0:8fZWUefmW7zhT9mvOyN05ojILznaH65JmWa20wvsd/bK1pVOX+t AlQKSkfNFPIr5y8DyDwhh4gLgNohRZIGHEIqF1HfhsV9mc2TrItipI4OlalTjP7mPoE9Nbq Rcjo6R1LnpSkdrZ2u08sjCF2XUR6BJA4/AdhZjc6FCc12WpbbIvs1PX8V+sKQERcZrb/BXv PntbxF0J8Fye9Qf8+P2Cw== X-UI-Out-Filterresults: notjunk:1; V01:K0:HdP2XQhOKSc=:qOFLKMAam4+VyLMAnSuDGM /nOfwcyPgDtX6atKKb/xMIsnxe7VwYtjVKO6BjXfy2befiqedxXQU+X+8eRgQzwCjQquKbOJp ubyshI3TFjYXSmPn9+b+LGQYklS7BJuK/8tUpkk3BToo9RQ4zbHXq/UGdtFcBVccsrJ4Inwo+ njd2U3uFsv3fOWlTM/sqfsrTpnqmnchx7FScHOvRqSU/FochC4yRVbo+S5SG0x7q07TdTOkIn iGdZoxH51nZe16Sm+i6Umj4wGei654ia8Jkide+hkAYm/hCMM2E9tlpLURXpNwKXn13kxdwT1 h7WkqHCOQMy0pvyMEkx47UtL8PxH4GSJLyWrCEfYFZUo8VgwDN561Z31cE0Th5JLjkylaOijG DVhBqIsJi4a039ibesj2OrnNHrHhZLkWBX3SbMxJjKX3ZqkfKtNMQ4rHVJDtiBEiAZAhaTJTM V2yERYjS987DNTyXGXWTG3nRITfnIx2x7bon3nqw02c6A5C0Sm7SpV+g242wj6LsGuK9Y3A6Z eP0R7qeCF4inDEkuM0PgluZrIQ6iC0sckl5R3O5A1KwRXwEnfgTjEv1mnJiA/E1suvLvVZO3o EPE4vAkBIlK01P9IGeP6eLEPufQopqgL/m2eKkiQpJZZfdJC5pYerzhUiBQbCdVQRk8MhhAAg 10yCOPdZaFsGibzk+6kbsZhB01zSKyJJy05mNMys5IypbwU3+LEM4m1Y7TX2H5PjjtA7wQAo/ 7SFHFboY3bBcRQrLkpwc7ACEBOIbqIVVYVbDybIA8Rzpy7aIcQoclnBxNDiEJF7KwTqNAXYWJ qGLGyb1p7yznppdUv69hx/YWvvXrG+DVvtFvlwIr1zSU1Gj2Aw= Sender: linux-renesas-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Markus Elfring Date: Tue, 24 Oct 2017 17:16:09 +0200 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/gpu/drm/rcar-du/rcar_du_kms.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/rcar-du/rcar_du_kms.c b/drivers/gpu/drm/rcar-du/rcar_du_kms.c index 566d1a948c8f..d2c80cc9f8ee 100644 --- a/drivers/gpu/drm/rcar-du/rcar_du_kms.c +++ b/drivers/gpu/drm/rcar-du/rcar_du_kms.c @@ -377,10 +377,8 @@ static int rcar_du_encoders_init(struct rcar_du_device *rcdu) int ret; ret = of_graph_parse_endpoint(ep_node, &ep); - if (ret < 0) { - of_node_put(ep_node); - return ret; - } + if (ret < 0) + goto put_node; /* Find the output route corresponding to the port number. */ for (i = 0; i < RCAR_DU_OUTPUT_MAX; ++i) { @@ -401,10 +399,8 @@ static int rcar_du_encoders_init(struct rcar_du_device *rcdu) /* Process the output pipeline. */ ret = rcar_du_encoders_init_one(rcdu, output, &ep); if (ret < 0) { - if (ret == -EPROBE_DEFER) { - of_node_put(ep_node); - return ret; - } + if (ret == -EPROBE_DEFER) + goto put_node; continue; } @@ -413,6 +409,10 @@ static int rcar_du_encoders_init(struct rcar_du_device *rcdu) } return num_encoders; + +put_node: + of_node_put(ep_node); + return ret; } static int rcar_du_properties_init(struct rcar_du_device *rcdu)