soc: qcom: ramdump: Fix the missed unmap of mapped memory

Before copying dump to userspace, memory is mapped and then the
content get copied to userspace and later that memory should be
unmapped.

Let's unmap the memory after the content get copied to
userspace.

Change-Id: I03d53ebd1cdb743e1820f226a49d46136eca4874
Signed-off-by: Mukesh Ojha <mojha@codeaurora.org>
This commit is contained in:
Mukesh Ojha 2020-09-30 12:41:21 +05:30 • committed by Gerrit - the friendly Code Review server
commit 75ae7139bd

View file

@ -262,6 +262,8 @@ static ssize_t ramdump_read(struct file *filep, char __user *buf, size_t count,
}
kfree(finalbuf);
if (!vaddr && origdevice_mem)
iounmap(origdevice_mem);
*pos += copy_size;
@ -275,6 +277,8 @@ static ssize_t ramdump_read(struct file *filep, char __user *buf, size_t count,
ramdump_done:
srcu_read_unlock(&rd_dev->rd_srcu, srcu_idx);
kfree(finalbuf);
if (!vaddr && origdevice_mem)
iounmap(origdevice_mem);
*pos = 0;
reset_ramdump_entry(entry);
return ret;