RE: [PATCH 1/3] Drivers: hv: vmbus: do cleanup on all vmbus_open() failure paths

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> -----Original Message-----
> From: Vitaly Kuznetsov [mailto:vkuznets@xxxxxxxxxx]
> Sent: Tuesday, April 21, 2015 16:18
> To: KY Srinivasan
> Cc: Haiyang Zhang; devel@xxxxxxxxxxxxxxxxxxxxxx; linux-
> kernel@xxxxxxxxxxxxxxx; Dexuan Cui
> Subject: [PATCH 1/3] Drivers: hv: vmbus: do cleanup on all vmbus_open()
> failure paths
> 
> In case there was an error reported in the response to the
> CHANNELMSG_OPENCHANNEL
> call we need to do the cleanup as a vmbus_open() user won't be doing it
> after
> receiving an error. The cleanup should be done on all failure paths.
> 
> Signed-off-by: Vitaly Kuznetsov <vkuznets@xxxxxxxxxx>
> ---
>  drivers/hv/channel.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/hv/channel.c b/drivers/hv/channel.c
> index 54da66d..836386f 100644
> --- a/drivers/hv/channel.c
> +++ b/drivers/hv/channel.c
> @@ -186,11 +186,12 @@ int vmbus_open(struct vmbus_channel
> *newchannel, u32 send_ringbuffer_size,
>  	list_del(&open_info->msglistentry);
>  	spin_unlock_irqrestore(&vmbus_connection.channelmsg_lock,
> flags);
> 
> -	if (err == 0)
> -		newchannel->state = CHANNEL_OPENED_STATE;
> +	if (err != 0)
> +		goto error_gpadl;
> 
> +	newchannel->state = CHANNEL_OPENED_STATE;
>  	kfree(open_info);
> -	return err;
> +	return 0;
> 
>  error1:
>  	spin_lock_irqsave(&vmbus_connection.channelmsg_lock, flags);
> --

Thanks for the patch, Vitaly!

The patch looks good to me except for 1 small issue:
I suppose open_info->response.open_result.status is different from
Linux-style -EXXX error codes.

Maybe here we can return -EAGAIN if err != 0 ?

-- Dexuan
_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel




[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux