ia64/xen-unstable

changeset 4002:aa00702b5bd6

bitkeeper revision 1.1159.258.23 (422d72b8gvbXrWsyznqgyF7shPiduw)

Fix error path handling not calling iounmap() after ioremap()

Signed-off-by: Yann Droneaud <ydroneaud@mandrakesoft.com>
Signed-off-by: Vincent Hanquez <vincent@xensource.com>
author vh249@airwolf.cl.cam.ac.uk
date Tue Mar 08 09:39:04 2005 +0000 (2005-03-08)
parents a5bf5769c2b8
children 17d3d7dd527c e674bd389503
files linux-2.6.10-xen-sparse/arch/xen/kernel/devmem.c
line diff
     1.1 --- a/linux-2.6.10-xen-sparse/arch/xen/kernel/devmem.c	Mon Mar 07 14:32:50 2005 +0000
     1.2 +++ b/linux-2.6.10-xen-sparse/arch/xen/kernel/devmem.c	Tue Mar 08 09:39:04 2005 +0000
     1.3 @@ -43,7 +43,7 @@ static ssize_t read_mem(struct file * fi
     1.4  			size_t count, loff_t *ppos)
     1.5  {
     1.6  	unsigned long i, p = *ppos;
     1.7 -	ssize_t read = 0;
     1.8 +	ssize_t read = -EFAULT;
     1.9  	void *v;
    1.10  
    1.11  	if ((v = ioremap(p, count)) == NULL) {
    1.12 @@ -60,12 +60,12 @@ static ssize_t read_mem(struct file * fi
    1.13  		return count;
    1.14  	}
    1.15  	if (copy_to_user(buf, v, count))
    1.16 -		return -EFAULT;
    1.17 -	iounmap(v);
    1.18 +		goto out;
    1.19  
    1.20 -	read += count;
    1.21 +	read = count;
    1.22  	*ppos += read;
    1.23 -
    1.24 +out:
    1.25 +	iounmap(v);
    1.26  	return read;
    1.27  }
    1.28  
    1.29 @@ -73,18 +73,18 @@ static ssize_t write_mem(struct file * f
    1.30  			 size_t count, loff_t *ppos)
    1.31  {
    1.32  	unsigned long p = *ppos;
    1.33 -	ssize_t written = 0;
    1.34 +	ssize_t written = -EFAULT;
    1.35  	void *v;
    1.36  
    1.37  	if ((v = ioremap(p, count)) == NULL)
    1.38  		return -EFAULT;
    1.39  	if (copy_to_user(v, buf, count))
    1.40 -		return -EFAULT;
    1.41 -	iounmap(v);
    1.42 +		goto out;
    1.43  
    1.44 -	written += count;
    1.45 +	written = count;
    1.46  	*ppos += written;
    1.47 -
    1.48 +out:
    1.49 +	iounmap(v);
    1.50  	return written;
    1.51  }
    1.52