From patchwork Thu Sep 22 06:21: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: 9345773 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 1E10A607D0 for ; Thu, 22 Sep 2016 16:08:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 104D32AB72 for ; Thu, 22 Sep 2016 16:08:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 050622ABA4; Thu, 22 Sep 2016 16:08: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 B92AA2AB72 for ; Thu, 22 Sep 2016 16:08:27 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1DBC96E8F5; Thu, 22 Sep 2016 16:08: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.4]) by gabe.freedesktop.org (Postfix) with ESMTPS id D3B746E8F5 for ; Thu, 22 Sep 2016 16:08:24 +0000 (UTC) Received: from [192.168.1.2] ([77.182.99.72]) by smtp.web.de (mrweb001) with ESMTPSA (Nemesis) id 0MAdb9-1bfUbV0FOV-00Bq7h; Thu, 22 Sep 2016 08:21:18 +0200 Subject: [PATCH 2/4] GPU-DRM-QXL: Move three assignments in qxl_device_init() To: dri-devel@lists.freedesktop.org, Bhaktipriya Shridhar , Daniel Vetter , David Airlie , =?UTF-8?Q?Noralf_Tr=c3=b8nnes?= , Tejun Heo , Thierry Reding References: From: SF Markus Elfring Message-ID: Date: Thu, 22 Sep 2016 08:21: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: X-Provags-ID: V03:K0:OWn6ksd5uO98Zsa/J1zBT6qmcAn+2+n5u7frn4T36oUAIcfvoDX zd+MmDZ8W/R66xitvg1v/sJYaV5QfVn+wnJk5eKYPU/s+BYYAVcD2D42M8Pvz8CMq9qETBS Wq5LplouDzzVsdv32Fq6RbMMRJlOt6c6aQ/iCSSGQs/Rw1zJ6ba+LnfOsmtTbMbLz8kq3Wt k4mEzQj6OuavLBP9FziSA== X-UI-Out-Filterresults: notjunk:1; V01:K0:2YeLGluUgew=:c41vECjbbqB837JEOtH+v7 JzrGvu2L357ozxLdDnamAJ3ch5OzR6rmx2daVtJyyzbWJlxGcGoxlvRN90k+/uTUMFaOQjxnn llFoRID5YYU8kgiRBWKPFNpViKp8FJdWn7r3Gd7JB8ku5j1fWCY1eian+x8qNO4qubssLvMBt XnujoRFCJwHs2TpMFghYg68Ze4RjY8+HRaI4uvG4FjI4GDklpXNwH7AsDLZx7eGnWapypeX25 7bWsKWcaEox8QpaJ7TbfLv3GILh6//ZCliygxTWFQIY5U9Zpvr31u0mFmXxtXnvSuPNt/cSvI rKr3Rx4SJhCx1aa+QMDEL2YopxEH0/8FC0iAGgSyf5bpQS7CQmL2hFp1NJEdmH25uy6DJcyBI ojiy4SI8eZC/n5kYnY18+k69Dsj9xQHV6AM+ezmi0TWvow71fntpZ+3WUoprq4nOckO6HVg9X xKTui9bR+9KA1u7CvupKD8lJAN9E8lKifIL9/qt/STxync3rzjJZP6nwFidJC+s7PfH3tAgNm XOQCs8KtwbZbcvVkCsAQun+TOzmXFZzJrnSZTLQTGv+KpXWCg6QX9mYdJ/icEKqLtSP3nPmXT cjJYy3Ns1PbixSS+f9fh9N7SPzy8YO/KZkCwUNMRKHJZufHLzi45ibW/fVgtqbluv0NO2NdPC srHq+1r1kSi8gttnMMiEQxAoZG75S5zAJAEwCoAWgQahVrj/wn0c0uVRneMhs8ri6lgkFPQWd 9e02yfwWVlKPiZPYxbInmA95mGJEt+o2ylUZc8nfmhWjH49CUPcqTJbVG9GkaIPzCunYy24hy 4HemVov 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 22:33:54 +0200 Move the assignments for three data structure members to the end so that they will only be performed if the desired resource allocations succeeded by this function. Signed-off-by: Markus Elfring --- drivers/gpu/drm/qxl/qxl_kms.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/qxl/qxl_kms.c b/drivers/gpu/drm/qxl/qxl_kms.c index 76852f1..76780c2 100644 --- a/drivers/gpu/drm/qxl/qxl_kms.c +++ b/drivers/gpu/drm/qxl/qxl_kms.c @@ -212,10 +212,6 @@ static int qxl_device_init(struct qxl_device *qdev, /* TODO - slot initialization should happen on reset. where is our * reset handler? */ qdev->n_mem_slots = qdev->rom->slots_end; - qdev->slot_gen_bits = qdev->rom->slot_gen_bits; - qdev->slot_id_bits = qdev->rom->slot_id_bits; - qdev->va_slot_mask = - (~(uint64_t)0) >> (qdev->slot_id_bits + qdev->slot_gen_bits); qdev->mem_slots = kmalloc_array(qdev->n_mem_slots, sizeof(*qdev->mem_slots), GFP_KERNEL); @@ -260,7 +256,10 @@ static int qxl_device_init(struct qxl_device *qdev, INIT_WORK(&qdev->gc_work, qxl_gc_work); - + qdev->slot_gen_bits = qdev->rom->slot_gen_bits; + qdev->slot_id_bits = qdev->rom->slot_id_bits; + qdev->va_slot_mask = + (~(uint64_t)0) >> (qdev->slot_id_bits + qdev->slot_gen_bits); return 0; }