Re: [PATCH] Staging: rts5139: sd_cprm: fix coding style issues

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

 



On Tue, May 29, 2012 at 12:30:19PM +0100, Adnan Ali wrote:
> This Commit fixes coding style issues including long lines,
> braces with single statment if condition, deprecated min().
> 
> Signed-off-by: Adnan Ali <adnan.ali@xxxxxxxxxxxxxxx>
> ---
>  drivers/staging/rts5139/sd_cprm.c |    8 ++++----
>  1 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/staging/rts5139/sd_cprm.c b/drivers/staging/rts5139/sd_cprm.c
> index f8c6071..ff336d3 100644
> --- a/drivers/staging/rts5139/sd_cprm.c
> +++ b/drivers/staging/rts5139/sd_cprm.c
> @@ -201,9 +201,8 @@ RTY_SEND_CMD:
>  			if (buf[1] & 0x80)
>  				TRACE_RET(chip, STATUS_FAIL);
>  		}
> -		if (buf[1] & 0x7F) {
> +		if (buf[1] & 0x7F)
>  			TRACE_RET(chip, STATUS_FAIL);
> -		}
>  		if (buf[2] & 0xF8)
>  			TRACE_RET(chip, STATUS_FAIL);
>  
> @@ -224,7 +223,8 @@ RTY_SEND_CMD:
>  	return STATUS_SUCCESS;
>  }
>  
> -static int ext_sd_get_rsp(struct rts51x_chip *chip, int len, u8 *rsp, u8 rsp_type)
> +static int ext_sd_get_rsp(struct rts51x_chip *chip, int len,
> +					 u8 *rsp, u8 rsp_type)

Don't right justify things here.  Line the 's' from struct with the
'u' from u8.

>  {
>  	int retval, rsp_len;
>  	u16 reg_addr;
> @@ -844,7 +844,7 @@ int sd_pass_thru_mode(struct scsi_cmnd *srb, struct rts51x_chip *chip)
>  
>  	buf[15] = chip->max_lun;
>  
> -	len = min(18, (int)scsi_bufflen(srb));
> +	len = min_t(int, 18, scsi_bufflen(srb));

It would be better to use "unsigned" instead of "int".  I don't
think it matters either way, but scsi_bufflen() returns unsigned and
it is a pain to audit this to see if it can return anything larger
than INT_MAX.  If we use "unsigned" here, then we don't need to
audit it.  More free time for everyone.  A change like that would
need to go in a separate commit.

regards,
dan carpenter

>  	rts51x_set_xfer_buf(buf, len, srb);
>  
>  	return TRANSPORT_GOOD;
> -- 
> 1.7.4.1
> 
> _______________________________________________
> devel mailing list
> devel@xxxxxxxxxxxxxxxxxxxxxx
> http://driverdev.linuxdriverproject.org/mailman/listinfo/devel
_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/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