Re: [PATCH v4 2/8] Staging: rts5208: rtsx_transport.c: Align to open parenthesis

From: Joe Perches
Date: Thu Feb 11 2016 - 23:32:26 EST


On Thu, 2016-02-11 at 20:07 -0800, Shaun Ren wrote:
> This patch fixes the alignment issue reported by checkpatch.pl:
>
> CHECK: Alignment should match open parenthesis
[]
> diff --git a/drivers/staging/rts5208/rtsx_transport.c b/drivers/staging/rts5208/rtsx_transport.c
[]
> @@ -52,12 +55,14 @@ unsigned int rtsx_stor_access_xfer_buf(unsigned char *buffer,
>   if (*offset >= scsi_bufflen(srb))
>   return 0;
>   cnt = min(buflen, scsi_bufflen(srb) - *offset);
> +
> + unsigned char *sgbuffer = (unsigned char *)scsi_sglist(srb) +
> + *offset;

Please don't declare variables in the middle of functions.
Variable declarations are only done at the beginning of functions.

> +
>   if (dir == TO_XFER_BUF)
> - memcpy((unsigned char *) scsi_sglist(srb) + *offset,
> - buffer, cnt);
> + memcpy(sgbuffer, buffer, cnt);
>   else
> - memcpy(buffer, (unsigned char *) scsi_sglist(srb) +
> - *offset, cnt);
> + memcpy(buffer, sgbuffer, cnt);
>   *offset += cnt;