From patchwork Wed Nov 1 14:44:58 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liviu Dudau X-Patchwork-Id: 10036449 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 93CFD6032D for ; Wed, 1 Nov 2017 14:45:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6239C28BBC for ; Wed, 1 Nov 2017 14:45:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 55B4D28BD7; Wed, 1 Nov 2017 14:45:10 +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 EFC5328BBC for ; Wed, 1 Nov 2017 14:45:09 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 84AAC6E77A; Wed, 1 Nov 2017 14:45:09 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from cam-smtp0.cambridge.arm.com (fw-tnat.cambridge.arm.com [217.140.96.140]) by gabe.freedesktop.org (Postfix) with ESMTPS id CB67B6E77A for ; Wed, 1 Nov 2017 14:45:08 +0000 (UTC) Received: from e110455-lin.cambridge.arm.com (e110455-lin.cambridge.arm.com [10.2.131.60]) by cam-smtp0.cambridge.arm.com (8.13.8/8.13.8) with ESMTP id vA1EiwQ7001349; Wed, 1 Nov 2017 14:44:58 GMT From: Liviu Dudau To: Daniel Vetter Subject: [PATCH v2] drm/drm_vma_manager.c: Remove useless goto statement Date: Wed, 1 Nov 2017 14:44:58 +0000 Message-Id: <20171101144458.5353-1-Liviu.Dudau@arm.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <150954635473.23379.7720989053009913694@mail.alporthouse.com> References: <150954635473.23379.7720989053009913694@mail.alporthouse.com> Cc: intel-gfx@lists.freedesktop.org, Liviu Dudau , DRI-devel 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: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Commit db2395eccf08i ("drm: Convert drm_vma_manager to embedded interval-tree in drm_mm") removed a line in drm_vma_offset_add() function that makes checking the result of calling drm_mm_insert_node() and the goto call redundant. Rework the function (as suggested by Chris Wilson) to eliminate the need for the goto and associated label. v2: rewrite function to remove all goto statements. Fixes: db2395eccf08i ("drm: Convert drm_vma_manager to embedded interval-tree in drm_mm") Cc: Chris Wilson Signed-off-by: Liviu Dudau Reviewed-by: Chris Wilson --- drivers/gpu/drm/drm_vma_manager.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/drm_vma_manager.c b/drivers/gpu/drm/drm_vma_manager.c index 28f1226576f8c..23c749c05b5aa 100644 --- a/drivers/gpu/drm/drm_vma_manager.c +++ b/drivers/gpu/drm/drm_vma_manager.c @@ -203,21 +203,16 @@ EXPORT_SYMBOL(drm_vma_offset_lookup_locked); int drm_vma_offset_add(struct drm_vma_offset_manager *mgr, struct drm_vma_offset_node *node, unsigned long pages) { - int ret; + int ret = 0; write_lock(&mgr->vm_lock); - if (drm_mm_node_allocated(&node->vm_node)) { - ret = 0; - goto out_unlock; - } + if (!drm_mm_node_allocated(&node->vm_node)) + ret = drm_mm_insert_node(&mgr->vm_addr_space_mm, + &node->vm_node, pages); - ret = drm_mm_insert_node(&mgr->vm_addr_space_mm, &node->vm_node, pages); - if (ret) - goto out_unlock; - -out_unlock: write_unlock(&mgr->vm_lock); + return ret; } EXPORT_SYMBOL(drm_vma_offset_add);