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: 10023755 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 99E7660381 for ; Tue, 24 Oct 2017 08:51:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 88072289A6 for ; Tue, 24 Oct 2017 08:51:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7CF3D289B3; Tue, 24 Oct 2017 08:51:01 +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 1B596289A6 for ; Tue, 24 Oct 2017 08:51:00 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 367EA6E3E0; Tue, 24 Oct 2017 08:51:00 +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 [217.72.192.78]) by gabe.freedesktop.org (Postfix) with ESMTPS id 5C8096E3E0 for ; Tue, 24 Oct 2017 08:50:58 +0000 (UTC) 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= 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 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,