From patchwork Tue Oct 24 17:34:14 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: 10025145 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 D013460375 for ; Tue, 24 Oct 2017 17:34:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C9E7C201BD for ; Tue, 24 Oct 2017 17:34:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BDEC425F31; Tue, 24 Oct 2017 17:34:28 +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 6361D201BD for ; Tue, 24 Oct 2017 17:34:28 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6E98A6E59B; Tue, 24 Oct 2017 17:34:27 +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.17.12]) by gabe.freedesktop.org (Postfix) with ESMTPS id 8BF716E59B for ; Tue, 24 Oct 2017 17:34:25 +0000 (UTC) Received: from [192.168.1.2] ([92.227.117.134]) by smtp.web.de (mrweb101 [213.165.67.124]) with ESMTPSA (Nemesis) id 0LwHxK-1d819d2y0U-0182UT; Tue, 24 Oct 2017 19:34:15 +0200 Subject: [PATCH 1/2] drm/tegra: Use common error handling code in tegra_output_probe() From: SF Markus Elfring To: dri-devel@lists.freedesktop.org, linux-tegra@vger.kernel.org, David Airlie , Jonathan Hunter , Thierry Reding References: Message-ID: Date: Tue, 24 Oct 2017 19:34:14 +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: Content-Language: en-GB X-Provags-ID: V03:K0:ZU7+feFLBOVsOQgm359V7Cn+OxYi8lB8qlZncRUU09MZgbAwosv PN23RalxR+Xo/lKy7ovCQ8pZWZ5mlv9xYYDykqibwXZgouCx3a0zAcSNTpU0CYWypU4KzY6 jBkOrfDbyHBfMNyZqgi8Z0SsP3DbHYlv2WFLztKmP32ABnx6bdhGtnwhyNdfzqKWdHGbPPM un6T9zSMiTCa0v20kRrIw== X-UI-Out-Filterresults: notjunk:1; V01:K0:Y4L8Ng85tJ8=:qpXx7Fi5IZdwk1/o8jWAvT sJ6vuH15It00lJreIpzr1hOfGnmA62/8h4kUJI1JwzDK65xtB8vuMnzxp/4/OfrFypwHjZ2vg 1ikz5bxZXly5Thr4vkOLFNhy6kAhBoTZLU5NTHk4llQ+FRAd7neVSHGUzd6hzeqM1dv0aayEz v1MJuHi4agm/mT1AA1vJ46wez69h21ACgTF2IpJFTxTODvRxoHCqf6OZFfpzqBbi0iXRaSmKI 9fPJgSUxEXIWjFRIXruzIqCRdJ0b5MLufCVGZIyVkkEHMNHInbsAibmbtXbnMDm4g3Khk/yNW 4ltd67wpz3eYwKWyLdF+u/+rtPl1105AI9JeIXiQgxjERmaYBK+zRekAW3cZF5dLOVB94Z6vb baREf37J5J226YGMJ35e0nhFZTleXEHOA9NM7x2XLr8CeiOtlHVyRA4Sfc6LY4qELsaC1px2G nykdlvb98oxzIJiJHuNJvNvUStDDyq0ObblKV/5fb954BHLmHu3VEDizmZo8GNgmioixr2zG1 QnAaNtdwRzF0uJGZOWILV3JRbVnyRV+JcCkYWaEuubBB2QBXz0fidz4wObV5xBgI/N1PVTBLH 2XJKeLjqx8DXLa2Q0cvPU1Ci9E0AxbwXe4dTLFq5jN2Dxt9xN1gbyu8Z4kpw4unVqIzOOMDDZ ax3d1UxXnUHSeswUVa16/UAe+ymOHMCShU6gNEpQ9HBNJqHa2qmg05f+Sz7wl9rvp3syAqRIF jpp+zvZqQ5xemabVde68efdi55BVMdZXvGpvbbQq2LBM+KQxdGiRm8ES9Vr6paV0DBT8ZqDg+ 2Oa6v2NdOuYEs+XmpRxNlXJn7SI7ZXbupurXUKcnpGC6eJhduA= 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: Tue, 24 Oct 2017 19:12: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/tegra/output.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/tegra/output.c b/drivers/gpu/drm/tegra/output.c index 595d1ec3e02e..1e0915e213b4 100644 --- a/drivers/gpu/drm/tegra/output.c +++ b/drivers/gpu/drm/tegra/output.c @@ -139,8 +139,7 @@ int tegra_output_probe(struct tegra_output *output) err = gpio_to_irq(output->hpd_gpio); if (err < 0) { dev_err(output->dev, "gpio_to_irq(): %d\n", err); - gpio_free(output->hpd_gpio); - return err; + goto free_gpio; } output->hpd_irq = err; @@ -153,8 +152,7 @@ int tegra_output_probe(struct tegra_output *output) if (err < 0) { dev_err(output->dev, "failed to request IRQ#%u: %d\n", output->hpd_irq, err); - gpio_free(output->hpd_gpio); - return err; + goto free_gpio; } output->connector.polled = DRM_CONNECTOR_POLL_HPD; @@ -168,6 +166,10 @@ int tegra_output_probe(struct tegra_output *output) } return 0; + +free_gpio: + gpio_free(output->hpd_gpio); + return err; } void tegra_output_remove(struct tegra_output *output)