From patchwork Tue Oct 24 08:50:50 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: 10023763 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 8596560381 for ; Tue, 24 Oct 2017 08:51:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 74923289B6 for ; Tue, 24 Oct 2017 08:51:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 68F08289BA; Tue, 24 Oct 2017 08:51:54 +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,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id DD033289B4 for ; Tue, 24 Oct 2017 08:51:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date: Message-ID:References:To:From:Subject:Reply-To:Content-ID:Content-Description :Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=JnLpTjcyNl6BqhUk4NsdFvoqAhoXg0Xv37rb2EoKRHQ=; b=iJNsq4KG0OJf3D 0LvxLv7RzcD80S6uguM8u4bsEEyUwEoz1ZDMSo/BUXj7Ni/qluv62vCm/4Ll3AVgzI/A+wibbfn0U s95KSHZB5TlNYSBJoKPidHMZmzQKQQcj+36/m3lHuIT9SVaJYWxs3bbka9x2wtQBZfZ4QRpC9bkcR d1jFsVmtVxiLwwmqGfSnEDEBpM9DzHj111u2R47svmGHIpK+fM+izBg02gxd5cBpeS5Kt05Lw1XIf FsDbjE50FhCALmaJrX4nsd00u/Tsq83AULMN2aN9Qs70uYUHcVeTl/gbqZ+n2IWHW5shSdJp3dfgY PNdrI7f4g3YgdyGkP1nA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1e6uwC-0004PQ-Cl; Tue, 24 Oct 2017 08:51:52 +0000 Received: from mout.web.de ([217.72.192.78]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1e6uvh-0003yG-1i for linux-arm-kernel@lists.infradead.org; Tue, 24 Oct 2017 08:51:40 +0000 Received: from [192.168.1.3] ([92.227.245.169]) by smtp.web.de (mrweb103 [213.165.67.124]) with ESMTPSA (Nemesis) id 0MejmG-1drQJ92l2m-00OHjQ; Tue, 24 Oct 2017 10:50:51 +0200 Subject: [PATCH 2/3] drm/exynos/gem: Use common error handling code in exynos_drm_gem_init() From: SF Markus Elfring To: dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, David Airlie , Inki Dae , Joonyoung Shim , Krzysztof Kozlowski , Kukjin Kim , Kyungmin Park , Seung-Woo Kim References: <7d4cdb43-432c-c67a-5d3f-c37bd604f539@users.sourceforge.net> Message-ID: <887019f4-4325-5b19-018a-32169e09462a@users.sourceforge.net> Date: Tue, 24 Oct 2017 10:50:50 +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: <7d4cdb43-432c-c67a-5d3f-c37bd604f539@users.sourceforge.net> Content-Language: en-GB X-Provags-ID: V03:K0:fumpgbUfrSTTYxe9wQon1rKyxH0Kcgsd7/6jMN/YHCKF0S5ly54 rQce8qZCqwBiuDIc0iJ5C6A/XLVWzly4ZfrB+v/VQT1qagUR8pODb0YLhqY6QkL2eUPDedq YFUp/7do4lDGGybrC1l9k4Eygbx07zjFYJyT8GtkeQAoAIYEe6hzgihYJGuH3T9he0OTpfz qMvSylR9LE/On/QlcktEg== X-UI-Out-Filterresults: notjunk:1; V01:K0:mUpg792YaKU=:biX4R6pRzxsu+a9CCBmOu2 /xFRZ27ykYpJGJaeWee6WyVKgb8YIYJ26F/RL8qy8n2gWN+Ddoyllo8GqWuLCWBEU3B60PsLm OxBxiIu+P/3koEtr5qyteUJFTyngZmg/RlF3gisCfJf7NrKT1si/lJpr1t9zG8C9ZeFM/fHAI oO/qWq09FhUt6TXvzgLKivCWSSi8z2OFe1XQefeKXGT2ECFCIOTHpWezsjwjvSwgdxFRs73Tx krB7YYrAj0T8EppWVsTx+MEKQbYjXMjUiKGFO1GOYzPhRfKTYxg0hfKjG3doaOZyK35iXjQlA rHVxsx84XG/pub/IhzwnvutGwcZ1SmMrWgod+7SDKC7cjlOPg43s5OwrGiRIm+9EVcyA2JJ61 bIg/6N7tH0spgXUjcKFKZlHP+hT7oZmLY22wS0KOR9pQoOu39C+bAX+9BCs+kmyggDagjkofl Ddxx1KcrlhlcArmvbQOwwI1i1bAyMnQ8Z8BN/lU0gfy59or0wacTVr6rRtvH0dt7IisON+qVp qSZ8iHSqOxLCvmFgEPpYZ5kp2uB8cK1nYvjYB7VC1Z7+2rZKqIwoNVK2S/azoBXtMmruZetJL XKe4PsEzByE0XexXl1l2cmU/BAylHCEYcHf2r79SlrItnL+FH7DWD9YrAVIWRZr1BJNr27jcq Z8DQ24/dFesOE4xq+UXs6V62hWGwmKWjGMoa9bZfnxWkxDmoUTdC4Q0hiQvUNui9ZqgR4beba i/23lJtj2CgLzogxyrqJeWRDhY9+nvCF2wWZksjV1k5+q+o0XPfzq1sSUFPQ8XnM69psVzYMe fXeZvBahXB3RTljlwNWa+Q3lx5R3TpgoMPTbsGB9/C/SSAmWBg= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171024_015121_862500_F0D6B3A6 X-CRM114-Status: GOOD ( 10.97 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kernel-janitors@vger.kernel.org, LKML Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Markus Elfring Date: Tue, 24 Oct 2017 09:50:54 +0200 Adjust jump targets 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/exynos/exynos_drm_gem.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_drm_gem.c b/drivers/gpu/drm/exynos/exynos_drm_gem.c index 077de014d610..1b3c9324cdd5 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_gem.c +++ b/drivers/gpu/drm/exynos/exynos_drm_gem.c @@ -208,20 +208,22 @@ static struct exynos_drm_gem *exynos_drm_gem_init(struct drm_device *dev, ret = drm_gem_object_init(dev, obj, size); if (ret < 0) { DRM_ERROR("failed to initialize gem object\n"); - kfree(exynos_gem); - return ERR_PTR(ret); + goto free_gem; } ret = drm_gem_create_mmap_offset(obj); - if (ret < 0) { - drm_gem_object_release(obj); - kfree(exynos_gem); - return ERR_PTR(ret); - } + if (ret < 0) + goto release_object; DRM_DEBUG_KMS("created file object = %pK\n", obj->filp); return exynos_gem; + +release_object: + drm_gem_object_release(obj); +free_gem: + kfree(exynos_gem); + return ERR_PTR(ret); } struct exynos_drm_gem *exynos_drm_gem_create(struct drm_device *dev,