[openib-general] [PATCH] set eq->nent earlier in mthca_create_eq

Michael S. Tsirkin mst at mellanox.co.il
Thu Sep 15 05:39:07 PDT 2005


Hi!

Since get_eqe uses eq->nent, it seems cleaner to set this field
to its proper value before calling get_eqe.
Existing code works because ib_alloc_device pre-zeroes the memory
that it allocates, so eq->nent is 0.

Signed-off-by: Michael S. Tsirkin <mst at mellanox.co.il>

Index: linux-2.6.13/drivers/infiniband/hw/mthca/mthca_eq.c
===================================================================
--- linux-2.6.13.orig/drivers/infiniband/hw/mthca/mthca_eq.c	2005-07-31 14:12:06.000000000 +0300
+++ linux-2.6.13/drivers/infiniband/hw/mthca/mthca_eq.c	2005-09-15 17:20:22.000000000 +0300
@@ -479,7 +479,7 @@ static int __devinit mthca_create_eq(str
 	/* Make sure EQ size is aligned to a power of 2 size. */
 	for (i = 1; i < nent; i <<= 1)
 		; /* nothing */
-	nent = i;
+	eq->nent = nent = i;
 
 	eq->dev = dev;
 
@@ -528,8 +528,6 @@ static int __devinit mthca_create_eq(str
 	if (err)
 		goto err_out_free_eq;
 
-	eq->nent = nent;
-
 	memset(eq_context, 0, sizeof *eq_context);
 	eq_context->flags           = cpu_to_be32(MTHCA_EQ_STATUS_OK   |
 						  MTHCA_EQ_OWNER_HW    |

-- 
MST



More information about the general mailing list