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: 117724 Delivered-To: patch@linaro.org Received: by 10.80.245.45 with SMTP id t42csp864003edm; Wed, 1 Nov 2017 07:45:40 -0700 (PDT) X-Google-Smtp-Source: ABhQp+QG7bNUIBgg65ZqhJL7i1i4ntBjS338mv8/jR6bdjSv3IThNgU3a5S1LDpOMc6hxuXE7GsK X-Received: by 10.98.234.4 with SMTP id t4mr87108pfh.179.1509547540321; Wed, 01 Nov 2017 07:45:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1509547540; cv=none; d=google.com; s=arc-20160816; b=oMRixtZDq2uKb16qKHduIPcOJGN2V1PshurjSa7iVUsnYrHPv2Akok8QL1JQAfQNoF HYlrthNQIPAuZosyCA25pBnJhHXqYOFkCiQT/3A79QG/MCvOZQ0EP8/5cQfpLrgEVM0C huv/Fw+Pz2LIdNenFic+Q9DdNyzwaUf+oKxpsUpG2WW9JI+A9R3d3FBvzLJ2CY7580xP l12K54us33FbPgz8wjRnLWr2ip6wS5PW4pMefMp1TW6CwEz5P66IxvIUuL1GOoHvN/9T yJ2/PbhBexDDz9maJ+U8QiTV1c2XIN1sLGw43gwnz8//Q0hVJ9NNafdqtdBKlWliirt4 OmQA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:cc:references:in-reply-to:message-id:date :subject:to:from:delivered-to:arc-authentication-results; bh=cAy39LdNNoJF2Qo3oMjyllkZ6Lkq9TcRavze87YV73M=; b=F3TdByng3aYADtIeoLv1IXCSwmyNLRz65llMYQp6VGJ9qJaBtunGcO9caZ148BLQhi j/qfX67uEmM2x4oPoyTqqAH5iZQ3hJ5rzl4HskapluF2UoJNiFOvs2wEHCegvbjZdKiG FU3krJdIsI3Lw/aVqkpaDJCPky9VKod78n1UnDMi6Q9WgfInmFc6pgLEhdpQwtWXNuO/ FxvX5/Ol+sIP0OX/WXP26gxktc30qcYR/YPVm84pmWbv5Ojv69ipYPpMYn2YRbUUCKt8 H2aqo/EFMJH0+T+3bFt6A5GQD/yet0zO2cPMZsywP8tb4lr7Xc884tvspDLtD3G/4D1o WM4Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id e11si1227219pgr.80.2017.11.01.07.45.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 01 Nov 2017 07:45:40 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org 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" 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);