Re: [PATCH v2 14/14] staging: unisys: visorbus: bus_configure add error handling

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

 



On Mon, Nov 21, 2016 at 12:15:53PM -0500, David Kershner wrote:
> Add proper error handling to bus_configure and have it propagate errors
> back up the stack. This helped to streamline the function as well.
> 
> Signed-off-by: David Kershner <david.kershner@xxxxxxxxxx>
> Reported-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
> ---
>  drivers/staging/unisys/visorbus/visorchipset.c | 45 +++++++++++++++++---------
>  1 file changed, 29 insertions(+), 16 deletions(-)
> 
> diff --git a/drivers/staging/unisys/visorbus/visorchipset.c b/drivers/staging/unisys/visorbus/visorchipset.c
> index 50e245e..95a2cf1 100644
> --- a/drivers/staging/unisys/visorbus/visorchipset.c
> +++ b/drivers/staging/unisys/visorbus/visorchipset.c
> @@ -820,14 +820,14 @@ enum crash_obj_type {
>  	return err;
>  }
>  
> -static void
> +static int
>  bus_configure(struct controlvm_message *inmsg,
>  	      struct parser_context *parser_ctx)
>  {
>  	struct controlvm_message_packet *cmd = &inmsg->cmd;
>  	u32 bus_no;
>  	struct visor_device *bus_info;
> -	int rc = CONTROLVM_RESP_SUCCESS;
> +	int err = 0;
>  
>  	bus_no = cmd->configure_bus.bus_no;
>  	POSTCODE_LINUX_3(BUS_CONFIGURE_ENTRY_PC, bus_no,
> @@ -837,28 +837,41 @@ enum crash_obj_type {
>  	if (!bus_info) {
>  		POSTCODE_LINUX_3(BUS_CONFIGURE_FAILURE_PC, bus_no,
>  				 POSTCODE_SEVERITY_ERR);
> -		rc = -CONTROLVM_RESP_ERROR_BUS_INVALID;
> +		err = -EINVAL;
> +		goto err_respond;
>  	} else if (bus_info->state.created == 0) {
>  		POSTCODE_LINUX_3(BUS_CONFIGURE_FAILURE_PC, bus_no,
>  				 POSTCODE_SEVERITY_ERR);
> -		rc = -CONTROLVM_RESP_ERROR_BUS_INVALID;
> +		err = -EINVAL;
> +		goto err_respond;
>  	} else if (bus_info->pending_msg_hdr) {
>  		POSTCODE_LINUX_3(BUS_CONFIGURE_FAILURE_PC, bus_no,
>  				 POSTCODE_SEVERITY_ERR);
> -		rc = -CONTROLVM_RESP_ERROR_MESSAGE_ID_INVALID_FOR_CLIENT;
> -	} else {
> -		visorchannel_set_clientpartition
> -			(bus_info->visorchannel,
> -			 cmd->configure_bus.guest_handle);
> -		bus_info->partition_uuid = parser_id_get(parser_ctx);
> -		parser_param_start(parser_ctx, PARSERSTRING_NAME);
> -		bus_info->name = parser_string_get(parser_ctx);
> -
> -		POSTCODE_LINUX_3(BUS_CONFIGURE_EXIT_PC, bus_no,
> -				 POSTCODE_SEVERITY_INFO);
> +		err = -EIO;
> +		goto err_respond;
>  	}
> +
> +	err = visorchannel_set_clientpartition
> +		(bus_info->visorchannel,
> +		 cmd->configure_bus.guest_handle);

Minor nit, that's a horrible way to format a function call.  You can fix
that up in a future patch please.

> +	POSTCODE_LINUX_3(BUS_CONFIGURE_EXIT_PC, bus_no,
> +			 POSTCODE_SEVERITY_INFO);

You are going to get rid of these crazy macros soon, right?

thanks,

greg k-h
_______________________________________________
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