libertas: Check return status of command functions
[linux-2.6.git] / drivers / net / wireless / libertas / debugfs.c
index 893a55ca344a34c73af379cf54f46003aec79788..587b0cb0088da57baa26be6fe34059bf0aeac670 100644 (file)
@@ -451,10 +451,12 @@ static ssize_t lbs_rdmac_read(struct file *file, char __user *userbuf,
                                CMD_MAC_REG_ACCESS, 0,
                                CMD_OPTION_WAITFORRSP, 0, &offval);
        mdelay(10);
-       pos += snprintf(buf+pos, len-pos, "MAC[0x%x] = 0x%08x\n",
+       if (!ret) {
+               pos += snprintf(buf+pos, len-pos, "MAC[0x%x] = 0x%08x\n",
                                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);
        return ret;
 }
@@ -514,7 +516,8 @@ static ssize_t lbs_wrmac_write(struct file *file,
                                CMD_OPTION_WAITFORRSP, 0, &offval);
        mdelay(10);
 
-       res = count;
+       if (!res)
+               res = count;
 out_unlock:
        free_page(addr);
        return res;
@@ -539,10 +542,12 @@ static ssize_t lbs_rdbbp_read(struct file *file, char __user *userbuf,
                                CMD_BBP_REG_ACCESS, 0,
                                CMD_OPTION_WAITFORRSP, 0, &offval);
        mdelay(10);
-       pos += snprintf(buf+pos, len-pos, "BBP[0x%x] = 0x%08x\n",
+       if (!ret) {
+               pos += snprintf(buf+pos, len-pos, "BBP[0x%x] = 0x%08x\n",
                                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);
 
        return ret;
@@ -603,7 +608,8 @@ static ssize_t lbs_wrbbp_write(struct file *file,
                                CMD_OPTION_WAITFORRSP, 0, &offval);
        mdelay(10);
 
-       res = count;
+       if (!res)
+               res = count;
 out_unlock:
        free_page(addr);
        return res;
@@ -628,10 +634,12 @@ static ssize_t lbs_rdrf_read(struct file *file, char __user *userbuf,
                                CMD_RF_REG_ACCESS, 0,
                                CMD_OPTION_WAITFORRSP, 0, &offval);
        mdelay(10);
-       pos += snprintf(buf+pos, len-pos, "RF[0x%x] = 0x%08x\n",
+       if (!ret) {
+               pos += snprintf(buf+pos, len-pos, "RF[0x%x] = 0x%08x\n",
                                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);
 
        return ret;
@@ -692,7 +700,8 @@ static ssize_t lbs_wrrf_write(struct file *file,
                                CMD_OPTION_WAITFORRSP, 0, &offval);
        mdelay(10);
 
-       res = count;
+       if (!res)
+               res = count;
 out_unlock:
        free_page(addr);
        return res;