aboutsummaryrefslogtreecommitdiff
path: root/drivers/net/wireless/mwifiex/debugfs.c
diff options
context:
space:
mode:
authorKevin Hilman <khilman@linaro.org>2015-12-17 08:48:38 -0800
committerKevin Hilman <khilman@linaro.org>2015-12-17 08:48:38 -0800
commit906d9eadd3b6698fa6ceb9bcdf41da6aa56d0a24 (patch)
treeb258d06410e154ce58d9b0d16ffba0834ff2a1ac /drivers/net/wireless/mwifiex/debugfs.c
parentd3d3a134d75d28034b950bc0b6682ba0be976f37 (diff)
parent9f41e6b222c4a04c7b46068df82842a6188b4a57 (diff)
Merge branch 'linux-linaro-lsk-v4.1' into linux-linaro-lsk-v4.1-rtlsk-v4.1-16.01-rtlsk-v4.1-15.12-rt
Diffstat (limited to 'drivers/net/wireless/mwifiex/debugfs.c')
-rw-r--r--drivers/net/wireless/mwifiex/debugfs.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/drivers/net/wireless/mwifiex/debugfs.c b/drivers/net/wireless/mwifiex/debugfs.c
index 1fb329dc6744..24e48bddf186 100644
--- a/drivers/net/wireless/mwifiex/debugfs.c
+++ b/drivers/net/wireless/mwifiex/debugfs.c
@@ -593,7 +593,7 @@ mwifiex_rdeeprom_read(struct file *file, char __user *ubuf,
(struct mwifiex_private *) file->private_data;
unsigned long addr = get_zeroed_page(GFP_KERNEL);
char *buf = (char *) addr;
- int pos = 0, ret = 0, i;
+ int pos, ret, i;
u8 value[MAX_EEPROM_DATA];
if (!buf)
@@ -601,7 +601,7 @@ mwifiex_rdeeprom_read(struct file *file, char __user *ubuf,
if (saved_offset == -1) {
/* No command has been given */
- pos += snprintf(buf, PAGE_SIZE, "0");
+ pos = snprintf(buf, PAGE_SIZE, "0");
goto done;
}
@@ -610,17 +610,17 @@ mwifiex_rdeeprom_read(struct file *file, char __user *ubuf,
(u16) saved_bytes, value);
if (ret) {
ret = -EINVAL;
- goto done;
+ goto out_free;
}
- pos += snprintf(buf, PAGE_SIZE, "%d %d ", saved_offset, saved_bytes);
+ pos = snprintf(buf, PAGE_SIZE, "%d %d ", saved_offset, saved_bytes);
for (i = 0; i < saved_bytes; i++)
- pos += snprintf(buf + strlen(buf), PAGE_SIZE, "%d ", value[i]);
-
- ret = simple_read_from_buffer(ubuf, count, ppos, buf, pos);
+ pos += scnprintf(buf + pos, PAGE_SIZE - pos, "%d ", value[i]);
done:
+ ret = simple_read_from_buffer(ubuf, count, ppos, buf, pos);
+out_free:
free_page(addr);
return ret;
}