ia64/xen-unstable
changeset 8529:96c7303b03ab
Fail early without calling dev_request_and_reply if memory cannot be allocated.
Signed-off-by: Vincent Hanquez <vincent@xensource.com>
Signed-off-by: Vincent Hanquez <vincent@xensource.com>
author | vhanquez@kneesa.uk.xensource.com |
---|---|
date | Mon Jan 09 11:31:49 2006 +0000 (2006-01-09) |
parents | 0ba3b9d60da6 |
children | fbf58585008a |
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 Mon Jan 09 12:25:05 2006 +0100 1.2 +++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_dev.c Mon Jan 09 11:31:49 2006 +0000 1.3 @@ -134,14 +134,17 @@ static ssize_t xenbus_dev_write(struct f 1.4 case XS_MKDIR: 1.5 case XS_RM: 1.6 case XS_SET_PERMS: 1.7 + if (u->u.msg.type == XS_TRANSACTION_START) { 1.8 + trans = kmalloc(sizeof(*trans), GFP_KERNEL); 1.9 + if (!trans) 1.10 + return -ENOMEM; 1.11 + } 1.12 + 1.13 reply = xenbus_dev_request_and_reply(&u->u.msg); 1.14 if (IS_ERR(reply)) 1.15 return PTR_ERR(reply); 1.16 1.17 if (u->u.msg.type == XS_TRANSACTION_START) { 1.18 - trans = kmalloc(sizeof(*trans), GFP_KERNEL); 1.19 - if (!trans) 1.20 - return -ENOMEM; 1.21 trans->handle = (struct xenbus_transaction *) 1.22 simple_strtoul(reply, NULL, 0); 1.23 list_add(&trans->list, &u->transactions);