ia64/xen-unstable

changeset 8514:a933d82321b3

Get rid of the err variable by directly returning error values.

Signed-off-by: Vincent Hanquez <vincent@xensource.com>
author vhanquez@kneesa.uk.xensource.com
date Fri Jan 06 22:03:58 2006 +0000 (2006-01-06)
parents 3c84ce41d184
children e93340cf4d02
files linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_dev.c
line diff
     1.1 --- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_dev.c	Fri Jan 06 18:14:29 2006 +0100
     1.2 +++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_dev.c	Fri Jan 06 22:03:58 2006 +0000
     1.3 @@ -111,7 +111,6 @@ static ssize_t xenbus_dev_write(struct f
     1.4  	struct xenbus_dev_data *u = filp->private_data;
     1.5  	struct xenbus_dev_transaction *trans;
     1.6  	void *reply;
     1.7 -	int err = 0;
     1.8  
     1.9  	if ((len + u->len) > sizeof(u->u.buffer))
    1.10  		return -EINVAL;
    1.11 @@ -136,41 +135,34 @@ static ssize_t xenbus_dev_write(struct f
    1.12  	case XS_RM:
    1.13  	case XS_SET_PERMS:
    1.14  		reply = xenbus_dev_request_and_reply(&u->u.msg);
    1.15 -		if (IS_ERR(reply)) {
    1.16 -			err = PTR_ERR(reply);
    1.17 -		} else {
    1.18 -			if (u->u.msg.type == XS_TRANSACTION_START) {
    1.19 -				trans = kmalloc(sizeof(*trans), GFP_KERNEL);
    1.20 -				trans->handle = (struct xenbus_transaction *)
    1.21 -					simple_strtoul(reply, NULL, 0);
    1.22 -				list_add(&trans->list, &u->transactions);
    1.23 -			} else if (u->u.msg.type == XS_TRANSACTION_END) {
    1.24 -				list_for_each_entry(trans, &u->transactions,
    1.25 -						    list)
    1.26 -					if ((unsigned long)trans->handle ==
    1.27 -					    (unsigned long)u->u.msg.tx_id)
    1.28 -						break;
    1.29 -				BUG_ON(&trans->list == &u->transactions);
    1.30 -				list_del(&trans->list);
    1.31 -				kfree(trans);
    1.32 -			}
    1.33 -			queue_reply(u, (char *)&u->u.msg, sizeof(u->u.msg));
    1.34 -			queue_reply(u, (char *)reply, u->u.msg.len);
    1.35 -			kfree(reply);
    1.36 +		if (IS_ERR(reply))
    1.37 +			return PTR_ERR(reply);
    1.38 +
    1.39 +		if (u->u.msg.type == XS_TRANSACTION_START) {
    1.40 +			trans = kmalloc(sizeof(*trans), GFP_KERNEL);
    1.41 +			trans->handle = (struct xenbus_transaction *)
    1.42 +				simple_strtoul(reply, NULL, 0);
    1.43 +			list_add(&trans->list, &u->transactions);
    1.44 +		} else if (u->u.msg.type == XS_TRANSACTION_END) {
    1.45 +			list_for_each_entry(trans, &u->transactions, list)
    1.46 +				if ((unsigned long)trans->handle ==
    1.47 +				    (unsigned long)u->u.msg.tx_id)
    1.48 +					break;
    1.49 +			BUG_ON(&trans->list == &u->transactions);
    1.50 +			list_del(&trans->list);
    1.51 +			kfree(trans);
    1.52  		}
    1.53 +		queue_reply(u, (char *)&u->u.msg, sizeof(u->u.msg));
    1.54 +		queue_reply(u, (char *)reply, u->u.msg.len);
    1.55 +		kfree(reply);
    1.56  		break;
    1.57  
    1.58  	default:
    1.59 -		err = -EINVAL;
    1.60 -		break;
    1.61 +		return -EINVAL;
    1.62  	}
    1.63  
    1.64 -	if (err == 0) {
    1.65 -		u->len = 0;
    1.66 -		err = len;
    1.67 -	}
    1.68 -
    1.69 -	return err;
    1.70 +	u->len = 0;
    1.71 +	return len;
    1.72  }
    1.73  
    1.74  static int xenbus_dev_open(struct inode *inode, struct file *filp)