From patchwork Wed Nov 1 14:25:54 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Wilson X-Patchwork-Id: 10036431 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 7F287602B5 for ; Wed, 1 Nov 2017 14:26:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EF49028BFC for ; Wed, 1 Nov 2017 14:26:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E3CC228C0C; Wed, 1 Nov 2017 14:26:02 +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 7E78C28BFC for ; Wed, 1 Nov 2017 14:26:02 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 54FD66E784; Wed, 1 Nov 2017 14:26:01 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from fireflyinternet.com (mail.fireflyinternet.com [109.228.58.192]) by gabe.freedesktop.org (Postfix) with ESMTPS id AFFF46E779 for ; Wed, 1 Nov 2017 14:25:59 +0000 (UTC) X-Default-Received-SPF: pass (skip=forwardok (res=PASS)) x-ip-name=78.156.65.138; Received: from localhost (unverified [78.156.65.138]) by fireflyinternet.com (Firefly Internet (M1)) with ESMTP (TLS) id 9418083-1500050 for multiple; Wed, 01 Nov 2017 14:25:57 +0000 MIME-Version: 1.0 To: Liviu Dudau , From: Chris Wilson In-Reply-To: <20171101142053.GF9700@e110455-lin.cambridge.arm.com> References: <20171101140424.2690-1-Liviu.Dudau@arm.com> <150954550465.23379.15884501343854867883@mail.alporthouse.com> <20171101142053.GF9700@e110455-lin.cambridge.arm.com> Message-ID: <150954635473.23379.7720989053009913694@mail.alporthouse.com> User-Agent: alot/0.3.6 Subject: Re: [PATCH] drm/drm_vma_manager.c: Remove useless goto statement Date: Wed, 01 Nov 2017 14:25:54 +0000 Cc: Daniel Vetter , 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: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Quoting Liviu Dudau (2017-11-01 14:20:53) > On Wed, Nov 01, 2017 at 02:11:44PM +0000, Chris Wilson wrote: > > Quoting Liviu Dudau (2017-11-01 14:04:24) > > > 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. Remove them. > > > > > > Fixes: db2395eccf08i ("drm: Convert drm_vma_manager to embedded interval-tree in drm_mm") > > > Cc: Chris Wilson > > > Signed-off-by: Liviu Dudau > > > --- > > > drivers/gpu/drm/drm_vma_manager.c | 2 -- > > > 1 file changed, 2 deletions(-) > > > > > > diff --git a/drivers/gpu/drm/drm_vma_manager.c b/drivers/gpu/drm/drm_vma_manager.c > > > index 28f1226576f8c..e545a7b2bcafc 100644 > > > --- a/drivers/gpu/drm/drm_vma_manager.c > > > +++ b/drivers/gpu/drm/drm_vma_manager.c > > > @@ -213,8 +213,6 @@ int drm_vma_offset_add(struct drm_vma_offset_manager *mgr, > > > } > > > > > > ret = drm_mm_insert_node(&mgr->vm_addr_space_mm, &node->vm_node, pages); > > > - if (ret) > > > - goto out_unlock; > > > > Whilst you are here, you might consider this function too simple to even > > require the out_unlock... > > Actually, looking at the function as it stands after the patch, if I > want to remove the out_unlock label I need to re-write the whole > function. Are you OK with me doing that? Yes. My suggestion is along the lines of Can you please cc functional patches like this to intel-gfx@lists.freedesktop.org? That will give us some reassurance that the change isn't outright horrible. ;) -Chris diff --git a/drivers/gpu/drm/drm_vma_manager.c b/drivers/gpu/drm/drm_vma_manager.c index 28f1226576f8..ba7857ed4361 100644 --- a/drivers/gpu/drm/drm_vma_manager.c +++ b/drivers/gpu/drm/drm_vma_manager.c @@ -207,17 +207,13 @@ int drm_vma_offset_add(struct drm_vma_offset_manager *mgr, write_lock(&mgr->vm_lock); - if (drm_mm_node_allocated(&node->vm_node)) { - ret = 0; - goto out_unlock; - } + ret = 0; + 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; }