From: Vasanthy Kolluri Date: Fri, 4 Feb 2011 16:17:10 +0000 (+0000) Subject: enic: Bug Fix: Fix return values of enic_add/del_station_addr routines X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=115d56f723c45088ddf46fac1ebba7c333039150;p=GitHub%2FLineageOS%2Fandroid_kernel_samsung_universal7580.git enic: Bug Fix: Fix return values of enic_add/del_station_addr routines Fix enic_add/del_station_addr routines to return appropriate error code when an invalid address is added or deleted. Signed-off-by: Christian Benvenuti Signed-off-by: Vasanthy Kolluri Signed-off-by: Roopa Prabhu Signed-off-by: David Wang Signed-off-by: David S. Miller --- diff --git a/drivers/net/enic/enic.h b/drivers/net/enic/enic.h index 1385a609ed4..f38ad634989 100644 --- a/drivers/net/enic/enic.h +++ b/drivers/net/enic/enic.h @@ -32,7 +32,7 @@ #define DRV_NAME "enic" #define DRV_DESCRIPTION "Cisco VIC Ethernet NIC Driver" -#define DRV_VERSION "2.1.1.3" +#define DRV_VERSION "2.1.1.4" #define DRV_COPYRIGHT "Copyright 2008-2011 Cisco Systems, Inc" #define ENIC_BARS_MAX 6 diff --git a/drivers/net/enic/enic_dev.c b/drivers/net/enic/enic_dev.c index a52dbd2b3c6..382626628b1 100644 --- a/drivers/net/enic/enic_dev.c +++ b/drivers/net/enic/enic_dev.c @@ -49,26 +49,28 @@ int enic_dev_stats_dump(struct enic *enic, struct vnic_stats **vstats) int enic_dev_add_station_addr(struct enic *enic) { - int err = 0; + int err; + + if (!is_valid_ether_addr(enic->netdev->dev_addr)) + return -EADDRNOTAVAIL; - if (is_valid_ether_addr(enic->netdev->dev_addr)) { - spin_lock(&enic->devcmd_lock); - err = vnic_dev_add_addr(enic->vdev, enic->netdev->dev_addr); - spin_unlock(&enic->devcmd_lock); - } + spin_lock(&enic->devcmd_lock); + err = vnic_dev_add_addr(enic->vdev, enic->netdev->dev_addr); + spin_unlock(&enic->devcmd_lock); return err; } int enic_dev_del_station_addr(struct enic *enic) { - int err = 0; + int err; + + if (!is_valid_ether_addr(enic->netdev->dev_addr)) + return -EADDRNOTAVAIL; - if (is_valid_ether_addr(enic->netdev->dev_addr)) { - spin_lock(&enic->devcmd_lock); - err = vnic_dev_del_addr(enic->vdev, enic->netdev->dev_addr); - spin_unlock(&enic->devcmd_lock); - } + spin_lock(&enic->devcmd_lock); + err = vnic_dev_del_addr(enic->vdev, enic->netdev->dev_addr); + spin_unlock(&enic->devcmd_lock); return err; }