From 42f65cbad4168958dff8a307bfe4b528409951d3 Mon Sep 17 00:00:00 2001 From: Amit Kumar Salecha Date: Tue, 22 Jun 2010 03:19:00 +0000 Subject: qlcnic: fix mac address mgmt We first add mac address in driver local list and then send command to fw to add same. There are checks in driver to ensure send command doesn't fail before adding mac address in local list. But instead fix should be: Add mac address in fw and if it succeeds, add it in driver local list. Signed-off-by: Amit Kumar Salecha Signed-off-by: David S. Miller --- drivers/net/qlcnic/qlcnic_hw.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'drivers/net/qlcnic/qlcnic_hw.c') diff --git a/drivers/net/qlcnic/qlcnic_hw.c b/drivers/net/qlcnic/qlcnic_hw.c index 10ba72302fc9..ad124254b6a9 100644 --- a/drivers/net/qlcnic/qlcnic_hw.c +++ b/drivers/net/qlcnic/qlcnic_hw.c @@ -413,10 +413,15 @@ static int qlcnic_nic_add_mac(struct qlcnic_adapter *adapter, u8 *addr) return -ENOMEM; } memcpy(cur->mac_addr, addr, ETH_ALEN); - list_add_tail(&cur->list, &adapter->mac_list); - return qlcnic_sre_macaddr_change(adapter, - cur->mac_addr, QLCNIC_MAC_ADD); + if (qlcnic_sre_macaddr_change(adapter, + cur->mac_addr, QLCNIC_MAC_ADD)) { + kfree(cur); + return -EIO; + } + + list_add_tail(&cur->list, &adapter->mac_list); + return 0; } void qlcnic_set_multi(struct net_device *netdev) -- cgit v1.2.3-59-g8ed1b