bnx2x: fix compilation without CONFIG_BNX2X_SRIOV
authorDmitry Kravkov <dmitry@broadcom.com>
Wed, 27 Mar 2013 08:56:10 +0000 (08:56 +0000)
committerDavid S. Miller <davem@davemloft.net>
Thu, 28 Mar 2013 03:26:14 +0000 (23:26 -0400)
Move mutex initialization by allocation of the mailbox it protects.

introduced in commit 1d6f3cd89 'bnx2x: Prevent VF race'

Signed-off-by: Dmitry Kravkov <dmitry@broadcom.com>
Reported-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c

index 10af03e433949396e02c39a35bd8f8132d34ec12..fdfe33bc097b25e83de5b23c96681d1166c7bb00 100644 (file)
@@ -12522,7 +12522,6 @@ static int bnx2x_init_one(struct pci_dev *pdev,
         */
        if (IS_VF(bp)) {
                bp->doorbells = bnx2x_vf_doorbells(bp);
-               mutex_init(&bp->vf2pf_mutex);
                rc = bnx2x_vf_pci_alloc(bp);
                if (rc)
                        goto init_one_exit;
index db63d8655fcacb41be86e75eb73e12c58d02b27f..2ce7c7471367812bc88375ab600211c7b2a437db 100644 (file)
@@ -3425,6 +3425,8 @@ void __iomem *bnx2x_vf_doorbells(struct bnx2x *bp)
 
 int bnx2x_vf_pci_alloc(struct bnx2x *bp)
 {
+       mutex_init(&bp->vf2pf_mutex);
+
        /* allocate vf2pf mailbox for vf to pf channel */
        BNX2X_PCI_ALLOC(bp->vf2pf_mbox, &bp->vf2pf_mbox_mapping,
                        sizeof(struct bnx2x_vf_mbx_msg));