diff options
Diffstat (limited to 'drivers/staging/wilc1000/netdev.c')
-rw-r--r-- | drivers/staging/wilc1000/netdev.c | 45 |
1 files changed, 17 insertions, 28 deletions
diff --git a/drivers/staging/wilc1000/netdev.c b/drivers/staging/wilc1000/netdev.c index 960dbc8d5173..0f48e74aa3ea 100644 --- a/drivers/staging/wilc1000/netdev.c +++ b/drivers/staging/wilc1000/netdev.c @@ -183,7 +183,7 @@ static int wilc_wlan_get_firmware(struct net_device *dev) { struct wilc_vif *vif = netdev_priv(dev); struct wilc *wilc = vif->wilc; - int chip_id, ret = 0; + int chip_id; const struct firmware *wilc_firmware; char *firmware; @@ -198,14 +198,11 @@ static int wilc_wlan_get_firmware(struct net_device *dev) if (request_firmware(&wilc_firmware, firmware, wilc->dev) != 0) { netdev_err(dev, "%s - firmware not available\n", firmware); - ret = -1; - goto fail; + return -EINVAL; } wilc->firmware = wilc_firmware; -fail: - - return ret; + return 0; } static int wilc_start_firmware(struct net_device *dev) @@ -215,7 +212,7 @@ static int wilc_start_firmware(struct net_device *dev) int ret = 0; ret = wilc_wlan_start(wilc); - if (ret < 0) + if (ret) return ret; if (!wait_for_completion_timeout(&wilc->sync_event, @@ -238,7 +235,7 @@ static int wilc1000_firmware_download(struct net_device *dev) ret = wilc_wlan_firmware_download(wilc, wilc->firmware->data, wilc->firmware->size); - if (ret < 0) + if (ret) return ret; release_firmware(wilc->firmware); @@ -417,7 +414,7 @@ static int wilc_init_fw_config(struct net_device *dev, struct wilc_vif *vif) return 0; fail: - return -1; + return -EINVAL; } static void wlan_deinitialize_threads(struct net_device *dev) @@ -497,14 +494,12 @@ static int wilc_wlan_initialize(struct net_device *dev, struct wilc_vif *vif) wl->close = 0; ret = wilc_wlan_init(dev); - if (ret < 0) - return -EIO; + if (ret) + return ret; ret = wlan_initialize_threads(dev); - if (ret < 0) { - ret = -EIO; + if (ret) goto fail_wilc_wlan; - } if (wl->gpio_irq && init_irq(dev)) { ret = -EIO; @@ -518,22 +513,17 @@ static int wilc_wlan_initialize(struct net_device *dev, struct wilc_vif *vif) goto fail_irq_init; } - if (wilc_wlan_get_firmware(dev)) { - ret = -EIO; + ret = wilc_wlan_get_firmware(dev); + if (ret) goto fail_irq_enable; - } ret = wilc1000_firmware_download(dev); - if (ret < 0) { - ret = -EIO; + if (ret) goto fail_irq_enable; - } ret = wilc_start_firmware(dev); - if (ret < 0) { - ret = -EIO; + if (ret) goto fail_irq_enable; - } if (wilc_wlan_cfg_get(vif, 1, WID_FIRMWARE_VERSION, 1, 0)) { int size; @@ -545,11 +535,10 @@ static int wilc_wlan_initialize(struct net_device *dev, struct wilc_vif *vif) firmware_ver[size] = '\0'; netdev_dbg(dev, "Firmware Ver = %s\n", firmware_ver); } - ret = wilc_init_fw_config(dev, vif); - if (ret < 0) { + ret = wilc_init_fw_config(dev, vif); + if (ret) { netdev_err(dev, "Failed to configure firmware\n"); - ret = -EIO; goto fail_fw_start; } wl->initialized = true; @@ -600,11 +589,11 @@ static int wilc_mac_open(struct net_device *ndev) netdev_dbg(ndev, "MAC OPEN[%p]\n", ndev); ret = wilc_init_host_int(ndev); - if (ret < 0) + if (ret) return ret; ret = wilc_wlan_initialize(ndev, vif); - if (ret < 0) { + if (ret) { wilc_deinit_host_int(ndev); return ret; } |