From patchwork Thu Sep 22 17:44:14 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SF Markus Elfring X-Patchwork-Id: 9346109 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 05EF0607D0 for ; Thu, 22 Sep 2016 17:44:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F2D832AA1F for ; Thu, 22 Sep 2016 17:44:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E79E22AC07; Thu, 22 Sep 2016 17:44:25 +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 777222AA1F for ; Thu, 22 Sep 2016 17:44:25 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B36466E91C; Thu, 22 Sep 2016 17:44:24 +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.4]) by gabe.freedesktop.org (Postfix) with ESMTPS id 317256E91C for ; Thu, 22 Sep 2016 17:44:23 +0000 (UTC) Received: from [192.168.1.2] ([77.182.99.72]) by smtp.web.de (mrweb004) with ESMTPSA (Nemesis) id 0MUBPu-1bNNwn47l4-00Qy5G; Thu, 22 Sep 2016 19:44:20 +0200 Subject: [PATCH 12/14] GPU-DRM-TTM: Less function calls in ttm_dma_pool_init() after error detection To: dri-devel@lists.freedesktop.org, Daniel Vetter , David Airlie , Emil Velikov References: <566ABCD9.1060404@users.sourceforge.net> <4d34446f-05ad-c3ce-5d33-8fb4f25af25c@users.sourceforge.net> From: SF Markus Elfring Message-ID: Date: Thu, 22 Sep 2016 19:44:14 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0 MIME-Version: 1.0 In-Reply-To: <4d34446f-05ad-c3ce-5d33-8fb4f25af25c@users.sourceforge.net> X-Provags-ID: V03:K0:3d8sqi5GMnlEnJw52AxeQ/thZ8luyC+C0o2MMo5d3Jv1qYbiYVE rmAkSO6CWcMILqfRDoE2mfmdGBu8QntnbJXGgaKxkTY3sA4zYiRN08wwsRiVb4oz+hcVuHI 5sc21NASNosmT7y/5Iywclcvr0W7vzyhu78LekVLxomn9A3UOWledGteTen00FvsfaS1WY5 kW0hovLVJ5vwyogc9N4fA== X-UI-Out-Filterresults: notjunk:1; V01:K0:KSEk1Fel6gA=:pg+B6dTQiwNI0wR1sLVNST 1vb/Zxar5wfD3qx0d6a3mtrrD0B185J1ocsSVI6vwJ8hWDl8yZ2XB+ulNcyJlfAKM/RWsUWLl wlWCseDZChGJ/LWGFC4HQwnZNAcEeKeEs45Kmn5O5fF2z7zdt6Y6QL45qeE4wtHPDZA0E/mvO ZRVEDkwQJ07ut/XMdTG2vGo+PdYnkY4L5SaLqHdo3V8T/s7iyw2eNTx6st6uZP2Nr/5vtl0vD gkaDsTpRP3cmXmaJKdlAn5FrU8BIXHVhhF0amJZaI4QVSAQl19NcPU4mj3YfmJaOjLrJnJ4nh 3AWah5U38loipg/xe8nA3fwdC6wNN3Xj8nMSZDHRhvJ+0oYblhSb19Ouity9y+Eqnueya5H17 RIKNQdUEpQJLR6e9rgO6179z0e1s2VLVn7OxHV7FRZJz3ceSOGg58FUuLOzgsUoAJTNMfvCXA VhuM0OZrVCUkB3rxfGjfSdbOSIfS+ZYYzjBhD05AG1qC6Lsd8SejItZXq3gsoxJ1kBmxAIpo0 6xT4o+4y1mjCKMIUxDH2bTzoVNtmGQfFy2234BQpwlCG61KnQuUJaElydLdLqE7NmUb+mSPAk 8yvmjW5AhoClRwpGPBuZpWljLMms4+dpIECe0eYkLGW0gH8UWn5aQl30k6oNyovMPh+HNCXfs 2Upj/tpMCMBb0mYEmPbeljpNGeN6cQrkqoRdb0Wz1F0aZ7FUDGGQISOFovxKQsKUWlV3Q7WMA 632ZhGtTIl3FUfQC964WGY7JSjrzPgjUwjiO6E7IQFz4Ju2LQYYYvO3gswhSsPtui5SWaLDzy DYefaGg Cc: Julia Lawall , 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: Thu, 22 Sep 2016 17:30:52 +0200 The kfree() function was called in up to two cases by the ttm_dma_pool_init() function during error handling even if the passed variable contained a null pointer. Adjust jump targets according to the Linux coding style convention. Signed-off-by: Markus Elfring --- drivers/gpu/drm/ttm/ttm_page_alloc_dma.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c b/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c index d5f41ed..4c50196 100644 --- a/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c +++ b/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c @@ -591,12 +591,12 @@ static struct dma_pool *ttm_dma_pool_init(struct device *dev, gfp_t flags, pool = kmalloc_node(sizeof(struct dma_pool), GFP_KERNEL, dev_to_node(dev)); if (!pool) - goto err_mem; + goto free_devres; sec_pool = kmalloc_node(sizeof(struct device_pools), GFP_KERNEL, dev_to_node(dev)); if (!sec_pool) - goto err_mem; + goto free_pool; INIT_LIST_HEAD(&sec_pool->pools); sec_pool->dev = dev; @@ -637,10 +637,10 @@ static struct dma_pool *ttm_dma_pool_init(struct device *dev, gfp_t flags, devres_add(dev, ptr); return pool; -err_mem: - devres_free(ptr); - kfree(sec_pool); + free_pool: kfree(pool); + free_devres: + devres_free(ptr); return ERR_PTR(-ENOMEM); }