From: BitKeeper B. <ri...@su...> - 2005-03-08 11:04:05
|
ChangeSet 1.1159.256.23, 2005/03/08 09:39:04+00:00, vh...@ai... Fix error path handling not calling iounmap() after ioremap() Signed-off-by: Yann Droneaud <ydr...@ma...> Signed-off-by: Vincent Hanquez <vi...@xe...> devmem.c | 20 ++++++++++---------- 1 files changed, 10 insertions(+), 10 deletions(-) diff -Nru a/linux-2.6.10-xen-sparse/arch/xen/kernel/devmem.c b/linux-2.6.10-xen-sparse/arch/xen/kernel/devmem.c --- a/linux-2.6.10-xen-sparse/arch/xen/kernel/devmem.c 2005-03-08 06:04:02 -05:00 +++ b/linux-2.6.10-xen-sparse/arch/xen/kernel/devmem.c 2005-03-08 06:04:02 -05:00 @@ -43,7 +43,7 @@ size_t count, loff_t *ppos) { unsigned long i, p = *ppos; - ssize_t read = 0; + ssize_t read = -EFAULT; void *v; if ((v = ioremap(p, count)) == NULL) { @@ -60,12 +60,12 @@ return count; } if (copy_to_user(buf, v, count)) - return -EFAULT; - iounmap(v); + goto out; - read += count; + read = count; *ppos += read; - +out: + iounmap(v); return read; } @@ -73,18 +73,18 @@ size_t count, loff_t *ppos) { unsigned long p = *ppos; - ssize_t written = 0; + ssize_t written = -EFAULT; void *v; if ((v = ioremap(p, count)) == NULL) return -EFAULT; if (copy_to_user(v, buf, count)) - return -EFAULT; - iounmap(v); + goto out; - written += count; + written = count; *ppos += written; - +out: + iounmap(v); return written; } |