Re: [PATCH 6/7] staging: vt6656: clean-up registers initialization error path

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

 



On Mon, May 20, 2019 at 04:39:04PM +0000, Quentin Deslandes wrote:
> Avoid discarding function's return code during register initialization.
> Handle it instead and return 0 on success or a negative errno value on
> error.
> 
> Signed-off-by: Quentin Deslandes <quentin.deslandes@xxxxxxxxxxx>
> ---
>  drivers/staging/vt6656/main_usb.c | 163 ++++++++++++++++++------------
>  1 file changed, 96 insertions(+), 67 deletions(-)
> 
> diff --git a/drivers/staging/vt6656/main_usb.c b/drivers/staging/vt6656/main_usb.c
> index 5fd845cbdd52..8ed96e8eedbe 100644
> --- a/drivers/staging/vt6656/main_usb.c
> +++ b/drivers/staging/vt6656/main_usb.c
> @@ -109,33 +109,38 @@ static void vnt_set_options(struct vnt_private *priv)
>   */
>  static int vnt_init_registers(struct vnt_private *priv)
>  {
> +	int ret = 0;

Minor nit here, no need to set this to 0 as you instantly set it with
this call:

>  	struct vnt_cmd_card_init *init_cmd = &priv->init_command;
>  	struct vnt_rsp_card_init *init_rsp = &priv->init_response;
>  	u8 antenna;
>  	int ii;
> -	int status = STATUS_SUCCESS;
>  	u8 tmp;
>  	u8 calib_tx_iq = 0, calib_tx_dc = 0, calib_rx_iq = 0;
>  
>  	dev_dbg(&priv->usb->dev, "---->INIbInitAdapter. [%d][%d]\n",
>  		DEVICE_INIT_COLD, priv->packet_type);
>  
> -	if (!vnt_check_firmware_version(priv)) {
> -		if (vnt_download_firmware(priv) == true) {
> -			if (vnt_firmware_branch_to_sram(priv) == false) {
> -				dev_dbg(&priv->usb->dev,
> -					" vnt_firmware_branch_to_sram fail\n");
> -				return false;
> -			}
> -		} else {
> -			dev_dbg(&priv->usb->dev, "FIRMWAREbDownload fail\n");
> -			return false;
> +	ret = vnt_check_firmware_version(priv);

You can fix that up in a later patch :)

At first glance, these all look really good, thanks for doing this work.

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