libertas: Check return status of command functions
Return status of lbs_prepare_and_send_command and lbs_cmd_with_response functions is not checked at some places. Those checks are added. Signed-off-by: Amitkumar Karwar <akarwar@marvell.com> Signed-off-by: Bing Zhao <bzhao@marvell.com> Acked-by: Dan Williams <dcbw@redhat.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
This commit is contained in:
committed by
John W. Linville
parent
be823e5b2d
commit
c0bbd57679
@@ -451,10 +451,12 @@ static ssize_t lbs_rdmac_read(struct file *file, char __user *userbuf,
|
|||||||
CMD_MAC_REG_ACCESS, 0,
|
CMD_MAC_REG_ACCESS, 0,
|
||||||
CMD_OPTION_WAITFORRSP, 0, &offval);
|
CMD_OPTION_WAITFORRSP, 0, &offval);
|
||||||
mdelay(10);
|
mdelay(10);
|
||||||
|
if (!ret) {
|
||||||
pos += snprintf(buf+pos, len-pos, "MAC[0x%x] = 0x%08x\n",
|
pos += snprintf(buf+pos, len-pos, "MAC[0x%x] = 0x%08x\n",
|
||||||
priv->mac_offset, priv->offsetvalue.value);
|
priv->mac_offset, priv->offsetvalue.value);
|
||||||
|
|
||||||
ret = simple_read_from_buffer(userbuf, count, ppos, buf, pos);
|
ret = simple_read_from_buffer(userbuf, count, ppos, buf, pos);
|
||||||
|
}
|
||||||
free_page(addr);
|
free_page(addr);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@@ -514,6 +516,7 @@ static ssize_t lbs_wrmac_write(struct file *file,
|
|||||||
CMD_OPTION_WAITFORRSP, 0, &offval);
|
CMD_OPTION_WAITFORRSP, 0, &offval);
|
||||||
mdelay(10);
|
mdelay(10);
|
||||||
|
|
||||||
|
if (!res)
|
||||||
res = count;
|
res = count;
|
||||||
out_unlock:
|
out_unlock:
|
||||||
free_page(addr);
|
free_page(addr);
|
||||||
@@ -539,10 +542,12 @@ static ssize_t lbs_rdbbp_read(struct file *file, char __user *userbuf,
|
|||||||
CMD_BBP_REG_ACCESS, 0,
|
CMD_BBP_REG_ACCESS, 0,
|
||||||
CMD_OPTION_WAITFORRSP, 0, &offval);
|
CMD_OPTION_WAITFORRSP, 0, &offval);
|
||||||
mdelay(10);
|
mdelay(10);
|
||||||
|
if (!ret) {
|
||||||
pos += snprintf(buf+pos, len-pos, "BBP[0x%x] = 0x%08x\n",
|
pos += snprintf(buf+pos, len-pos, "BBP[0x%x] = 0x%08x\n",
|
||||||
priv->bbp_offset, priv->offsetvalue.value);
|
priv->bbp_offset, priv->offsetvalue.value);
|
||||||
|
|
||||||
ret = simple_read_from_buffer(userbuf, count, ppos, buf, pos);
|
ret = simple_read_from_buffer(userbuf, count, ppos, buf, pos);
|
||||||
|
}
|
||||||
free_page(addr);
|
free_page(addr);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
@@ -603,6 +608,7 @@ static ssize_t lbs_wrbbp_write(struct file *file,
|
|||||||
CMD_OPTION_WAITFORRSP, 0, &offval);
|
CMD_OPTION_WAITFORRSP, 0, &offval);
|
||||||
mdelay(10);
|
mdelay(10);
|
||||||
|
|
||||||
|
if (!res)
|
||||||
res = count;
|
res = count;
|
||||||
out_unlock:
|
out_unlock:
|
||||||
free_page(addr);
|
free_page(addr);
|
||||||
@@ -628,10 +634,12 @@ static ssize_t lbs_rdrf_read(struct file *file, char __user *userbuf,
|
|||||||
CMD_RF_REG_ACCESS, 0,
|
CMD_RF_REG_ACCESS, 0,
|
||||||
CMD_OPTION_WAITFORRSP, 0, &offval);
|
CMD_OPTION_WAITFORRSP, 0, &offval);
|
||||||
mdelay(10);
|
mdelay(10);
|
||||||
|
if (!ret) {
|
||||||
pos += snprintf(buf+pos, len-pos, "RF[0x%x] = 0x%08x\n",
|
pos += snprintf(buf+pos, len-pos, "RF[0x%x] = 0x%08x\n",
|
||||||
priv->rf_offset, priv->offsetvalue.value);
|
priv->rf_offset, priv->offsetvalue.value);
|
||||||
|
|
||||||
ret = simple_read_from_buffer(userbuf, count, ppos, buf, pos);
|
ret = simple_read_from_buffer(userbuf, count, ppos, buf, pos);
|
||||||
|
}
|
||||||
free_page(addr);
|
free_page(addr);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
@@ -692,6 +700,7 @@ static ssize_t lbs_wrrf_write(struct file *file,
|
|||||||
CMD_OPTION_WAITFORRSP, 0, &offval);
|
CMD_OPTION_WAITFORRSP, 0, &offval);
|
||||||
mdelay(10);
|
mdelay(10);
|
||||||
|
|
||||||
|
if (!res)
|
||||||
res = count;
|
res = count;
|
||||||
out_unlock:
|
out_unlock:
|
||||||
free_page(addr);
|
free_page(addr);
|
||||||
|
@@ -1089,6 +1089,8 @@ static void auto_deepsleep_timer_fn(unsigned long data)
|
|||||||
ret = lbs_prepare_and_send_command(priv,
|
ret = lbs_prepare_and_send_command(priv,
|
||||||
CMD_802_11_DEEP_SLEEP, 0,
|
CMD_802_11_DEEP_SLEEP, 0,
|
||||||
0, 0, NULL);
|
0, 0, NULL);
|
||||||
|
if (ret)
|
||||||
|
lbs_pr_err("Enter Deep Sleep command failed\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mod_timer(&priv->auto_deepsleep_timer , jiffies +
|
mod_timer(&priv->auto_deepsleep_timer , jiffies +
|
||||||
|
@@ -1022,9 +1022,12 @@ int lbs_get_scan(struct net_device *dev, struct iw_request_info *info,
|
|||||||
return -EAGAIN;
|
return -EAGAIN;
|
||||||
|
|
||||||
/* Update RSSI if current BSS is a locally created ad-hoc BSS */
|
/* Update RSSI if current BSS is a locally created ad-hoc BSS */
|
||||||
if ((priv->mode == IW_MODE_ADHOC) && priv->adhoccreate)
|
if ((priv->mode == IW_MODE_ADHOC) && priv->adhoccreate) {
|
||||||
lbs_prepare_and_send_command(priv, CMD_802_11_RSSI, 0,
|
err = lbs_prepare_and_send_command(priv, CMD_802_11_RSSI, 0,
|
||||||
CMD_OPTION_WAITFORRSP, 0, NULL);
|
CMD_OPTION_WAITFORRSP, 0, NULL);
|
||||||
|
if (err)
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
mutex_lock(&priv->lock);
|
mutex_lock(&priv->lock);
|
||||||
list_for_each_entry_safe (iter_bss, safe, &priv->network_list, list) {
|
list_for_each_entry_safe (iter_bss, safe, &priv->network_list, list) {
|
||||||
@@ -1058,7 +1061,7 @@ int lbs_get_scan(struct net_device *dev, struct iw_request_info *info,
|
|||||||
|
|
||||||
dwrq->length = (ev - extra);
|
dwrq->length = (ev - extra);
|
||||||
dwrq->flags = 0;
|
dwrq->flags = 0;
|
||||||
|
out:
|
||||||
lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", err);
|
lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", err);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
@@ -832,7 +832,7 @@ static struct iw_statistics *lbs_get_wireless_stats(struct net_device *dev)
|
|||||||
u32 rssi_qual;
|
u32 rssi_qual;
|
||||||
u32 tx_qual;
|
u32 tx_qual;
|
||||||
u32 quality = 0;
|
u32 quality = 0;
|
||||||
int stats_valid = 0;
|
int ret, stats_valid = 0;
|
||||||
u8 rssi;
|
u8 rssi;
|
||||||
u32 tx_retries;
|
u32 tx_retries;
|
||||||
struct cmd_ds_802_11_get_log log;
|
struct cmd_ds_802_11_get_log log;
|
||||||
@@ -881,7 +881,9 @@ static struct iw_statistics *lbs_get_wireless_stats(struct net_device *dev)
|
|||||||
|
|
||||||
memset(&log, 0, sizeof(log));
|
memset(&log, 0, sizeof(log));
|
||||||
log.hdr.size = cpu_to_le16(sizeof(log));
|
log.hdr.size = cpu_to_le16(sizeof(log));
|
||||||
lbs_cmd_with_response(priv, CMD_802_11_GET_LOG, &log);
|
ret = lbs_cmd_with_response(priv, CMD_802_11_GET_LOG, &log);
|
||||||
|
if (ret)
|
||||||
|
goto out;
|
||||||
|
|
||||||
tx_retries = le32_to_cpu(log.retry);
|
tx_retries = le32_to_cpu(log.retry);
|
||||||
|
|
||||||
@@ -909,8 +911,10 @@ static struct iw_statistics *lbs_get_wireless_stats(struct net_device *dev)
|
|||||||
stats_valid = 1;
|
stats_valid = 1;
|
||||||
|
|
||||||
/* update stats asynchronously for future calls */
|
/* update stats asynchronously for future calls */
|
||||||
lbs_prepare_and_send_command(priv, CMD_802_11_RSSI, 0,
|
ret = lbs_prepare_and_send_command(priv, CMD_802_11_RSSI, 0,
|
||||||
0, 0, NULL);
|
0, 0, NULL);
|
||||||
|
if (ret)
|
||||||
|
lbs_pr_err("RSSI command failed\n");
|
||||||
out:
|
out:
|
||||||
if (!stats_valid) {
|
if (!stats_valid) {
|
||||||
priv->wstats.miss.beacon = 0;
|
priv->wstats.miss.beacon = 0;
|
||||||
|
Reference in New Issue
Block a user