diff --git a/drivers/char/xilinx_hwicap/xilinx_hwicap.c b/drivers/char/xilinx_hwicap/xilinx_hwicap.c
index 9bb5fa642fd8..bbeb9b6060dc 100644
--- a/drivers/char/xilinx_hwicap/xilinx_hwicap.c
+++ b/drivers/char/xilinx_hwicap/xilinx_hwicap.c
@@ -382,7 +382,7 @@ hwicap_read(struct file *file, char __user *buf, size_t count, loff_t *ppos)
4 - bytes_to_read);
} else {
/* Get new data from the ICAP, and return what was requested. */
- kbuf = (u32 *) get_zeroed_page(GFP_KERNEL);
+ kbuf = kzalloc(PAGE_SIZE, GFP_KERNEL);
if (!kbuf) {
status = -ENOMEM;
goto error;@@ -412,13 +412,13 @@ hwicap_read(struct file *file, char __user *buf, size_t count, loff_t *ppos)
/* If we didn't read correctly, then bail out. */
if (status) {
- free_page((unsigned long)kbuf);
+ kfree(kbuf);
goto error;
}
/* If we fail to return the data to the user, then bail out. */
if (copy_to_user(buf, kbuf, bytes_to_read)) {
- free_page((unsigned long)kbuf);
+ kfree(kbuf);
status = -EFAULT;
goto error;
}@@ -426,7 +426,7 @@ hwicap_read(struct file *file, char __user *buf, size_t count, loff_t *ppos)
kbuf,
bytes_remaining);
drvdata->read_buffer_in_use = bytes_remaining;
- free_page((unsigned long)kbuf);
+ kfree(kbuf);
}
status = bytes_to_read;
error:
@@ -457,7 +457,7 @@ hwicap_write(struct file *file, const char __user *buf,
goto error;
}
- kbuf = (u32 *) __get_free_page(GFP_KERNEL);
+ kbuf = kmalloc(PAGE_SIZE, GFP_KERNEL);
if (!kbuf) {
status = -ENOMEM;
goto error;@@ -479,13 +479,13 @@ hwicap_write(struct file *file, const char __user *buf,
(((char *)kbuf) + drvdata->write_buffer_in_use),
buf + written,
len - (drvdata->write_buffer_in_use))) {
- free_page((unsigned long)kbuf);
+ kfree(kbuf);
status = -EFAULT;
goto error;
}
} else {
if (copy_from_user(kbuf, buf + written, len)) {
- free_page((unsigned long)kbuf);
+ kfree(kbuf);
status = -EFAULT;
goto error;
}@@ -495,7 +495,7 @@ hwicap_write(struct file *file, const char __user *buf,
kbuf, len >> 2);
if (status) {
- free_page((unsigned long)kbuf);
+ kfree(kbuf);
status = -EFAULT;
goto error;
}@@ -516,7 +516,7 @@ hwicap_write(struct file *file, const char __user *buf,
}
}
- free_page((unsigned long)kbuf);
+ kfree(kbuf);
status = written;
error:
mutex_unlock(&drvdata->sem);
--
2.53.0