From patchwork Wed Nov 1 15:39:54 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: 10036643 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 AE1686032D for ; Wed, 1 Nov 2017 15:40:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A87AC28C66 for ; Wed, 1 Nov 2017 15:40:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9D17628C7F; Wed, 1 Nov 2017 15:40:17 +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 3612028C66 for ; Wed, 1 Nov 2017 15:40:16 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 214C46E79E; Wed, 1 Nov 2017 15:40:16 +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.14]) by gabe.freedesktop.org (Postfix) with ESMTPS id 960436E79E for ; Wed, 1 Nov 2017 15:40:14 +0000 (UTC) Received: from [192.168.1.3] ([77.182.103.203]) by smtp.web.de (mrweb004 [213.165.67.108]) with ESMTPSA (Nemesis) id 0MHuv7-1e8Xfl0Pdt-003Zqo; Wed, 01 Nov 2017 16:39:56 +0100 Subject: [PATCH v2 1/2] drm/rcar-du: Use common error handling code in rcar_du_encoders_init() From: SF Markus Elfring To: kbuild test robot , dri-devel@lists.freedesktop.org, linux-renesas-soc@vger.kernel.org, Dan Carpenter , David Airlie , Jani Nikula , Laurent Pinchart References: <201710262044.165nsaJp%fengguang.wu@intel.com> <26b811dd-9dfa-cfd3-7d4d-e7f1c852b8ed@users.sourceforge.net> Message-ID: <56554dfd-6990-e104-ea70-e457f250fe5d@users.sourceforge.net> Date: Wed, 1 Nov 2017 16:39:54 +0100 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: <26b811dd-9dfa-cfd3-7d4d-e7f1c852b8ed@users.sourceforge.net> Content-Language: en-GB X-Provags-ID: V03:K0:HE9RSuzO50HXIGtZiJXidKNhjmN0pM8B9n7a/o5FUd8UtpLvj4p XCgOsHBngw1j3oArD98r/5LYneMbI02Ybit8eVZdybIUR1WqdJKG56uu7grAmz/hVbGqlXr T96PQXBhQO89phj7ZSso1kv2Wb2DTmNw40K5yn569O5uJIzobLFwY759DefwBdbvjTdOHR4 HT4oM6C3J63am10SZs9jA== X-UI-Out-Filterresults: notjunk:1; V01:K0:CXn7Oq9vlgI=:FvJ85+ju4X3PcnIg2bxKw/ VgUxWhMIik5mjaW5P6TI/UaibPlePKpsva9t37Q9ySAvpMQ5sKrlKg35MHP/v24YfPBhxVSno 3OypxqizXy8+RyoDODpx6U8lQn4O8kL6RQdN9J7BGXKHQPkJjbsQD6Cyasg2rvOGmgGps/Bmq 0BjzZ74pJyMMrOJgOyhFBctimNV6iS5M3ZODyGo4fPnCqkv5bRT2wcVNSrH/TLSB4f/ALVU1Y FKoIWPcSnIirPIUGitqsmaTjhoNcg9Urmb1IYSzDnTYxujEpM+JwKlOnIRqi8ksse7+YY5C8j j8Ra4eILMfrC7zjQBUTwkAV35b2aFoZPb/bEGWU8CmnJ1TEdy1NmEmpQvP5sFtGBLkiWKAn15 7ueeJFGBFtWSJGIx9ctAN88bMu1gUOUrMtnr9JX0rVuWv5Hy5oXY7rp/5mWPsfaC5wdE0MVb2 iUFFW2PcXYJb3/EVCA7jIEIhzU0aIvyY+9u2mkS7Z3lBkldz8CToCnO3FjvPLnWYD4DiP85Sj 4zSHkkT3cGwG91kyU3DVZcQmPvtJMzDq4lWZoO+Ty9ZdaJN+cHmo3lyTG362BuQZQUli5yJcb maHM79XUGDzbNvSy4k61jQD9Crx9SthBtwTN8oKfED+12A9xMUhAWFiZifhybme1sFke9HxUm enXU+OJP+Vwa0Kq7pnuNtaDcnmS5vTT7CrqCN66aiIY28QuyJxjjU+P+b1KgrRJcFcU8j6o6+ JEpDgNRJwL1YE1X/TeBG6PBbYp4bOli89xCbEeKkqLFDBV4btpP8/4/n+Ype6YnLbsA+uGp/f QuV+3AT+dnkPa+euKY7Bw+X6Ww+9303vNzixH0si/tIxbvqM9I= Cc: Geert Uytterhoeven , kernel-janitors@vger.kernel.org, LKML , kbuild-all@01.org 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: Wed, 1 Nov 2017 15:57:31 +0100 * Add a jump target so that a bit of exception handling can be better reused at the end of this function. * Increase the scope for the variable "ret". This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring --- v2: The declaration for the variable "ret" was moved out of a loop. drivers/gpu/drm/rcar-du/rcar_du_kms.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 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..b6b341164aab 100644 --- a/drivers/gpu/drm/rcar-du/rcar_du_kms.c +++ b/drivers/gpu/drm/rcar-du/rcar_du_kms.c @@ -365,6 +365,7 @@ static int rcar_du_encoders_init(struct rcar_du_device *rcdu) struct device_node *np = rcdu->dev->of_node; struct device_node *ep_node; unsigned int num_encoders = 0; + int ret; /* * Iterate over the endpoints and create one encoder for each output @@ -374,13 +375,10 @@ static int rcar_du_encoders_init(struct rcar_du_device *rcdu) enum rcar_du_output output; struct of_endpoint ep; unsigned int i; - 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)