Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1488569

[PATCH 2/4] GPU-DRM-QXL: Move three assignments in qxl_device_init()

From SF Markus Elfring <elfring@users.sourceforge.net>
Newsgroups linux.kernel
Subject [PATCH 2/4] GPU-DRM-QXL: Move three assignments in qxl_device_init()
Date 2016-09-22 08:30 +0200
Message-ID <sk5G9-2NH-5@gated-at.bofh.it> (permalink)
References <sk5G9-2NH-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: Markus Elfring <elfring@users.sourceforge.net>
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 <elfring@users.sourceforge.net>
---
 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;
 }
 
-- 
2.10.0

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 0/4] GPU-DRM-QXL: Fine-tuning for three function  implementations SF Markus Elfring <elfring@users.sourceforge.net> - 2016-09-22 08:30 +0200
  [PATCH 2/4] GPU-DRM-QXL: Move three assignments in qxl_device_init() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-09-22 08:30 +0200
    Re: [PATCH 2/4] GPU-DRM-QXL: Move three assignments in  qxl_device_init() Dan Carpenter <dan.carpenter@oracle.com> - 2016-09-22 12:20 +0200
      Re: GPU-DRM-QXL: Move three assignments in qxl_device_init() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-09-22 15:20 +0200
        Re: GPU-DRM-QXL: Move three assignments in qxl_device_init() Gerd Hoffmann <kraxel@redhat.com> - 2016-09-22 17:50 +0200
          Re: GPU-DRM-QXL: Move three assignments in qxl_device_init() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-09-22 19:20 +0200
            Re: GPU-DRM-QXL: Move three assignments in qxl_device_init() Gerd Hoffmann <kraxel@redhat.com> - 2016-09-22 22:30 +0200
        Re: GPU-DRM-QXL: Move three assignments in qxl_device_init() Dan Carpenter <dan.carpenter@oracle.com> - 2016-09-22 22:30 +0200
          Re: GPU-DRM-QXL: Move three assignments in qxl_device_init() Sean Paul <seanpaul@chromium.org> - 2016-09-23 09:30 +0200
            Re: GPU-DRM-QXL: Move three assignments in qxl_device_init() Dave Airlie <airlied@gmail.com> - 2016-09-23 10:00 +0200
              Re: GPU-DRM-QXL: Move three assignments in qxl_device_init() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-09-23 11:00 +0200
            Re: GPU-DRM-QXL: Move three assignments in qxl_device_init() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-09-23 10:50 +0200
          Re: GPU-DRM-QXL: Move three assignments in qxl_device_init() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-09-23 10:40 +0200
  [PATCH 3/4] GPU-DRM-QXL: Improve a size determination in  qxl_driver_load() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-09-22 08:30 +0200
  [PATCH 4/4] GPU-DRM-QXL: Adjust checks for null pointers in three  functions SF Markus Elfring <elfring@users.sourceforge.net> - 2016-09-22 08:30 +0200

csiph-web