From patchwork Wed Sep 21 16:54:19 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: 9343927 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 5C836607D4 for ; Wed, 21 Sep 2016 16:54:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5E0B32A805 for ; Wed, 21 Sep 2016 16:54:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 52B292A808; Wed, 21 Sep 2016 16:54:28 +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 E2DF02A805 for ; Wed, 21 Sep 2016 16:54:27 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 3C9E56E87A; Wed, 21 Sep 2016 16:54:27 +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.3]) by gabe.freedesktop.org (Postfix) with ESMTPS id 813246E87A for ; Wed, 21 Sep 2016 16:54:25 +0000 (UTC) Received: from [192.168.1.2] ([77.182.212.253]) by smtp.web.de (mrweb001) with ESMTPSA (Nemesis) id 0MF3Rz-1bkDP51Fvv-00GFzr; Wed, 21 Sep 2016 18:54:20 +0200 Subject: [PATCH 12/14] GPU-DRM-OMAP: Move a variable assignment in omap_gem_attach_pages() To: dri-devel@lists.freedesktop.org, David Airlie , Laurent Pinchart , Tomi Valkeinen References: <566ABCD9.1060404@users.sourceforge.net> <0ea38611-3d93-0ade-a1fb-f8cc2e0b8d61@users.sourceforge.net> From: SF Markus Elfring Message-ID: <50aaf72b-eb09-0a81-9856-800d797b7ccb@users.sourceforge.net> Date: Wed, 21 Sep 2016 18:54:19 +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: <0ea38611-3d93-0ade-a1fb-f8cc2e0b8d61@users.sourceforge.net> X-Provags-ID: V03:K0:PR3V431/2zLDdK4vbq360eZLdvHVAiVLIPviSeSQWdMBJ9ybn3i QtknSB9N46eGz1gOqgNTLMKSfadf7ljklx5FREQ7TvoxzFogOnMDs2GRpYEta8ZLmM+HeYX K90b++KcErwbFB7Kr5xqfwewGxaNNRnSQ0O4pby7jWeIRNuxbMbXOAgCyIsSzjHQEqV8HXJ N9UcdX0Ja2zXOB3d0NnSA== X-UI-Out-Filterresults: notjunk:1; V01:K0:ZowLJ6Qbxjw=:Bhvh/LJE1GG2e1GdoVziSb aIxEXpYALtkx+2Yb8V8cMKEwwAzPOtcgvGVvTyvG/bCJjQh3V5YKy1iVr4zEh613tl0FcX5wF atH32c/iCIaw9FoPxa5s88Gw7ixw70n4qCOpePnHhSZI32Q3n26SeXqfbzy+pHQZR3QfeEPfM KD9nym/VND56TdmrCrSZxaY8aa/YRcQwkWivrZuNSZExbcwdnrvP5ZXUO5ov8xOOwlbVl288D KEtszaLsQu38B8z5sNDrIeA+vNuhR9vw5kEjJfe9lUpBjqLr2cSD0D19piDyH+X5qibbKW4bU od6PSfVHIAlh+S2AA1n9e5cfEhwCnllsqdIkVIGWn5tsUz6U9ykYk2iLAN9hXuOcwyLvyOqVD 1RvL+RUSznuof/zUh1xSI9OpJlQSs0oPSQkzqjh6QAGi61lpyx0AFFJMYFXGkm000qf+suUVw AY5WrGi4U1npHs+hsHtbJ8oVRV/Ml8y+qoKZdnjiDAUGyWAYz1zZo6ppsd/oCkvIZAfdqbCvo KYIG3Nn6xQqh/jTy97KgeXADqtPXkqJp86g16YjySjZH2JdxYqBCVbDlCqe2HeHlS1Wfx2skL z36sJpdzMcC96EM8JM7poDEX6xhq5Cg5H3dVU6568ev6mn8DzIb/2At4iSx4d8G8WnZnv9hc/ oK704vv9rJ1bkAixtCJIEzOosX9wgpa8f9RXkoklxcHnpvDzR/DnsY4HUk+6XWNuhruugqmN4 Izw9fGP2XzDGoJvaZ7quTIHEc9smRDOQvrWoAy790JMAFh+jGo3u4hzSo6jsvoQuCDayXvxvM EbzwuNq 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: Wed, 21 Sep 2016 17:42:28 +0200 Move one assignment for the local variable "npages" so that its setting will only be performed after a call of the function "drm_gem_get_pages" succeeded by this function. Signed-off-by: Markus Elfring --- drivers/gpu/drm/omapdrm/omap_gem.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/omapdrm/omap_gem.c b/drivers/gpu/drm/omapdrm/omap_gem.c index 26f1212..3c49ad9 100644 --- a/drivers/gpu/drm/omapdrm/omap_gem.c +++ b/drivers/gpu/drm/omapdrm/omap_gem.c @@ -243,7 +243,7 @@ static int omap_gem_attach_pages(struct drm_gem_object *obj) struct drm_device *dev = obj->dev; struct omap_gem_object *omap_obj = to_omap_bo(obj); struct page **pages; - int npages = obj->size >> PAGE_SHIFT; + int npages; int i, ret; dma_addr_t *addrs; @@ -255,6 +255,8 @@ static int omap_gem_attach_pages(struct drm_gem_object *obj) return PTR_ERR(pages); } + npages = obj->size >> PAGE_SHIFT; + /* for non-cached buffers, ensure the new pages are clean because * DSS, GPU, etc. are not cache coherent: */