diff --git a/drivers/net/wireless/marvell/libertas/debugfs.c b/drivers/net/wireless/marvell/libertas/debugfs.c index 9ebd69134940..9428f954837a 100644 --- a/drivers/net/wireless/marvell/libertas/debugfs.c +++ b/drivers/net/wireless/marvell/libertas/debugfs.c @@ -35,8 +35,7 @@ static ssize_t lbs_dev_info(struct file *file, char __user *userbuf, { struct lbs_private *priv = file->private_data; size_t pos = 0; - unsigned long addr = get_zeroed_page(GFP_KERNEL); - char *buf = (char *)addr; + char *buf = kzalloc(PAGE_SIZE, GFP_KERNEL); ssize_t res; if (!buf) return -ENOMEM; @@ -48,7 +47,7 @@ static ssize_t lbs_dev_info(struct file *file, char __user *userbuf, res = simple_read_from_buffer(userbuf, count, ppos, buf, pos); - free_page(addr); + kfree(buf); return res; } @@ -96,8 +95,7 @@ static ssize_t lbs_sleepparams_read(struct file *file, char __user *userbuf, ssize_t ret; size_t pos = 0; struct sleep_params sp; - unsigned long addr = get_zeroed_page(GFP_KERNEL); - char *buf = (char *)addr; + char *buf = kzalloc(PAGE_SIZE, GFP_KERNEL); if (!buf) return -ENOMEM; @@ -113,7 +111,7 @@ static ssize_t lbs_sleepparams_read(struct file *file, char __user *userbuf, ret = simple_read_from_buffer(userbuf, count, ppos, buf, pos); out_unlock: - free_page(addr); + kfree(buf); return ret; } @@ -165,8 +163,7 @@ static ssize_t lbs_host_sleep_read(struct file *file, char __user *userbuf, struct lbs_private *priv = file->private_data; ssize_t ret; size_t pos = 0; - unsigned long addr = get_zeroed_page(GFP_KERNEL); - char *buf = (char *)addr; + char *buf = kzalloc(PAGE_SIZE, GFP_KERNEL); if (!buf) return -ENOMEM; @@ -174,7 +171,7 @@ static ssize_t lbs_host_sleep_read(struct file *file, char __user *userbuf, ret = simple_read_from_buffer(userbuf, count, ppos, buf, pos); - free_page(addr); + kfree(buf); return ret; } @@ -228,7 +225,7 @@ static ssize_t lbs_threshold_read(uint16_t tlv_type, uint16_t event_mask, u8 freq; int events = 0; - buf = (char *)get_zeroed_page(GFP_KERNEL); + buf = kzalloc(PAGE_SIZE, GFP_KERNEL); if (!buf) return -ENOMEM; @@ -261,7 +258,7 @@ static ssize_t lbs_threshold_read(uint16_t tlv_type, uint16_t event_mask, kfree(subscribed); out_page: - free_page((unsigned long)buf); + kfree(buf); return ret; } @@ -436,8 +433,7 @@ static ssize_t lbs_rdmac_read(struct file *file, char __user *userbuf, struct lbs_private *priv = file->private_data; ssize_t pos = 0; int ret; - unsigned long addr = get_zeroed_page(GFP_KERNEL); - char *buf = (char *)addr; + char *buf = kzalloc(PAGE_SIZE, GFP_KERNEL); u32 val = 0; if (!buf) @@ -450,7 +446,7 @@ static ssize_t lbs_rdmac_read(struct file *file, char __user *userbuf, priv->mac_offset, val); ret = simple_read_from_buffer(userbuf, count, ppos, buf, pos); } - free_page(addr); + kfree(buf); return ret; } @@ -506,8 +502,7 @@ static ssize_t lbs_rdbbp_read(struct file *file, char __user *userbuf, struct lbs_private *priv = file->private_data; ssize_t pos = 0; int ret; - unsigned long addr = get_zeroed_page(GFP_KERNEL); - char *buf = (char *)addr; + char *buf = kzalloc(PAGE_SIZE, GFP_KERNEL); u32 val; if (!buf) @@ -520,7 +515,7 @@ static ssize_t lbs_rdbbp_read(struct file *file, char __user *userbuf, priv->bbp_offset, val); ret = simple_read_from_buffer(userbuf, count, ppos, buf, pos); } - free_page(addr); + kfree(buf); return ret; } @@ -578,8 +573,7 @@ static ssize_t lbs_rdrf_read(struct file *file, char __user *userbuf, struct lbs_private *priv = file->private_data; ssize_t pos = 0; int ret; - unsigned long addr = get_zeroed_page(GFP_KERNEL); - char *buf = (char *)addr; + char *buf = kzalloc(PAGE_SIZE, GFP_KERNEL); u32 val; if (!buf) @@ -592,7 +586,7 @@ static ssize_t lbs_rdrf_read(struct file *file, char __user *userbuf, priv->rf_offset, val); ret = simple_read_from_buffer(userbuf, count, ppos, buf, pos); } - free_page(addr); + kfree(buf); return ret; } @@ -812,8 +806,7 @@ static ssize_t lbs_debugfs_read(struct file *file, char __user *userbuf, char *p; int i; struct debug_data *d; - unsigned long addr = get_zeroed_page(GFP_KERNEL); - char *buf = (char *)addr; + char *buf = kzalloc(PAGE_SIZE, GFP_KERNEL); if (!buf) return -ENOMEM; @@ -836,7 +829,7 @@ static ssize_t lbs_debugfs_read(struct file *file, char __user *userbuf, res = simple_read_from_buffer(userbuf, count, ppos, p, pos); - free_page(addr); + kfree(buf); return res; }