]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
mlx4_core: Initialize ctx_list and ctx_lock earlier
authorRoland Dreier <rolandd@cisco.com>
Thu, 7 Jun 2007 18:51:58 +0000 (11:51 -0700)
committerRoland Dreier <rolandd@cisco.com>
Thu, 7 Jun 2007 18:51:58 +0000 (11:51 -0700)
We may call mlx4_dispatch_event() before mlx4_register_device() is
called for a device, because for example a catastrophic error happens
immediately after we enable interrupts.  Therefore priv->ctx_list and
priv->ctx_lock need to be initialized earlier.

This bug was actually exposed by the MSI-X bug that returned IRQ numbers
to drivers in reverse order, so that the first FW command
interrupt looked to mlx4 like a catastrophic error.

Signed-off-by: Roland Dreier <rolandd@cisco.com>
drivers/net/mlx4/intf.c
drivers/net/mlx4/main.c

index 65854f9e9c76c0fe67ba87dc02b90b72a2f4b3c8..9ae951bf6aa681116bc914db52699d62e6857d19 100644 (file)
@@ -135,9 +135,6 @@ int mlx4_register_device(struct mlx4_dev *dev)
        struct mlx4_priv *priv = mlx4_priv(dev);
        struct mlx4_interface *intf;
 
-       INIT_LIST_HEAD(&priv->ctx_list);
-       spin_lock_init(&priv->ctx_lock);
-
        mutex_lock(&intf_mutex);
 
        list_add_tail(&priv->dev_list, &dev_list);
index 20b8c0d3ced42bf4fad98df36508fc8483b429f0..d4172937025b05afbd26765a297e53b338c2a066 100644 (file)
@@ -787,6 +787,8 @@ static int __devinit mlx4_init_one(struct pci_dev *pdev,
 
        dev       = &priv->dev;
        dev->pdev = pdev;
+       INIT_LIST_HEAD(&priv->ctx_list);
+       spin_lock_init(&priv->ctx_lock);
 
        /*
         * Now reset the HCA before we touch the PCI capabilities or