aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hv/channel.c
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-10-29 11:44:40 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-10-29 11:44:40 -0400
commite64de3b96c1ba3c1de236a4a103ec21234a5849f (patch)
treeb4ed91858a3d353bd72e3be101433ac821759379 /drivers/hv/channel.c
parentdbfd5ccc057fbefb7247614741efbf96be0258c5 (diff)
parent8f0d8163b50e01f398b14bcd4dc039ac5ab18d64 (diff)
Merge 3.7-rc3 into char-misc-next
This brings in the various 3.7-rc3 char fixes into char-misc-next. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/hv/channel.c')
-rw-r--r--drivers/hv/channel.c24
1 files changed, 13 insertions, 11 deletions
diff --git a/drivers/hv/channel.c b/drivers/hv/channel.c
index 1bb1a801a90d..773a2f25a8f0 100644
--- a/drivers/hv/channel.c
+++ b/drivers/hv/channel.c
@@ -138,14 +138,14 @@ int vmbus_open(struct vmbus_channel *newchannel, u32 send_ringbuffer_size,
138 138
139 if (ret != 0) { 139 if (ret != 0) {
140 err = ret; 140 err = ret;
141 goto errorout; 141 goto error0;
142 } 142 }
143 143
144 ret = hv_ringbuffer_init( 144 ret = hv_ringbuffer_init(
145 &newchannel->inbound, in, recv_ringbuffer_size); 145 &newchannel->inbound, in, recv_ringbuffer_size);
146 if (ret != 0) { 146 if (ret != 0) {
147 err = ret; 147 err = ret;
148 goto errorout; 148 goto error0;
149 } 149 }
150 150
151 151
@@ -160,7 +160,7 @@ int vmbus_open(struct vmbus_channel *newchannel, u32 send_ringbuffer_size,
160 160
161 if (ret != 0) { 161 if (ret != 0) {
162 err = ret; 162 err = ret;
163 goto errorout; 163 goto error0;
164 } 164 }
165 165
166 /* Create and init the channel open message */ 166 /* Create and init the channel open message */
@@ -169,7 +169,7 @@ int vmbus_open(struct vmbus_channel *newchannel, u32 send_ringbuffer_size,
169 GFP_KERNEL); 169 GFP_KERNEL);
170 if (!open_info) { 170 if (!open_info) {
171 err = -ENOMEM; 171 err = -ENOMEM;
172 goto errorout; 172 goto error0;
173 } 173 }
174 174
175 init_completion(&open_info->waitevent); 175 init_completion(&open_info->waitevent);
@@ -185,7 +185,7 @@ int vmbus_open(struct vmbus_channel *newchannel, u32 send_ringbuffer_size,
185 185
186 if (userdatalen > MAX_USER_DEFINED_BYTES) { 186 if (userdatalen > MAX_USER_DEFINED_BYTES) {
187 err = -EINVAL; 187 err = -EINVAL;
188 goto errorout; 188 goto error0;
189 } 189 }
190 190
191 if (userdatalen) 191 if (userdatalen)
@@ -200,19 +200,18 @@ int vmbus_open(struct vmbus_channel *newchannel, u32 send_ringbuffer_size,
200 sizeof(struct vmbus_channel_open_channel)); 200 sizeof(struct vmbus_channel_open_channel));
201 201
202 if (ret != 0) 202 if (ret != 0)
203 goto cleanup; 203 goto error1;
204 204
205 t = wait_for_completion_timeout(&open_info->waitevent, 5*HZ); 205 t = wait_for_completion_timeout(&open_info->waitevent, 5*HZ);
206 if (t == 0) { 206 if (t == 0) {
207 err = -ETIMEDOUT; 207 err = -ETIMEDOUT;
208 goto errorout; 208 goto error1;
209 } 209 }
210 210
211 211
212 if (open_info->response.open_result.status) 212 if (open_info->response.open_result.status)
213 err = open_info->response.open_result.status; 213 err = open_info->response.open_result.status;
214 214
215cleanup:
216 spin_lock_irqsave(&vmbus_connection.channelmsg_lock, flags); 215 spin_lock_irqsave(&vmbus_connection.channelmsg_lock, flags);
217 list_del(&open_info->msglistentry); 216 list_del(&open_info->msglistentry);
218 spin_unlock_irqrestore(&vmbus_connection.channelmsg_lock, flags); 217 spin_unlock_irqrestore(&vmbus_connection.channelmsg_lock, flags);
@@ -220,9 +219,12 @@ cleanup:
220 kfree(open_info); 219 kfree(open_info);
221 return err; 220 return err;
222 221
223errorout: 222error1:
224 hv_ringbuffer_cleanup(&newchannel->outbound); 223 spin_lock_irqsave(&vmbus_connection.channelmsg_lock, flags);
225 hv_ringbuffer_cleanup(&newchannel->inbound); 224 list_del(&open_info->msglistentry);
225 spin_unlock_irqrestore(&vmbus_connection.channelmsg_lock, flags);
226
227error0:
226 free_pages((unsigned long)out, 228 free_pages((unsigned long)out,
227 get_order(send_ringbuffer_size + recv_ringbuffer_size)); 229 get_order(send_ringbuffer_size + recv_ringbuffer_size));
228 kfree(open_info); 230 kfree(open_info);