Merge branches 'pm-cpufreq', 'pm-cpuidle', 'pm-devfreq', 'pm-opp' and 'pm-tools'
[linux-drm-fsl-dcu.git] / drivers / xen / xenbus / xenbus_dev_frontend.c
index 85534ea6355588a79a2f589963edb7c146ebac83..9433e46518c8dc8680fd1e5a44d823aa7f65fdb0 100644 (file)
@@ -326,10 +326,13 @@ static int xenbus_write_transaction(unsigned msg_type,
        }
 
        if (msg_type == XS_TRANSACTION_START) {
-               trans->handle.id = simple_strtoul(reply, NULL, 0);
-
-               list_add(&trans->list, &u->transactions);
-       } else if (msg_type == XS_TRANSACTION_END) {
+               if (u->u.msg.type == XS_ERROR)
+                       kfree(trans);
+               else {
+                       trans->handle.id = simple_strtoul(reply, NULL, 0);
+                       list_add(&trans->list, &u->transactions);
+               }
+       } else if (u->u.msg.type == XS_TRANSACTION_END) {
                list_for_each_entry(trans, &u->transactions, list)
                        if (trans->handle.id == u->u.msg.tx_id)
                                break;