diff mbox series

[04/20] media: drxd: drop offset var from DownloadMicrocode()

Message ID f4d081b88635e114d69cda30526fa04927be89d2.1637781097.git.mchehab+huawei@kernel.org (mailing list archive)
State New, archived
Headers show
Series Solve the remaining issues with clang and W=1 on media | expand

Commit Message

Mauro Carvalho Chehab Nov. 24, 2021, 7:13 p.m. UTC
The offset is not needed, and it is never used, as the pointer
itself is already incremented.

So, drop it, in order to solve a W=1 clang warning.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
---

To avoid mailbombing on a large number of people, only mailing lists were C/C on the cover.
See [PATCH 00/20] at: https://lore.kernel.org/all/cover.1637781097.git.mchehab+huawei@kernel.org/

 drivers/media/dvb-frontends/drxd_hard.c | 8 --------
 1 file changed, 8 deletions(-)

Comments

Nathan Chancellor Nov. 26, 2021, 6:57 p.m. UTC | #1
On Wed, Nov 24, 2021 at 08:13:07PM +0100, Mauro Carvalho Chehab wrote:
> The offset is not needed, and it is never used, as the pointer
> itself is already incremented.
> 
> So, drop it, in order to solve a W=1 clang warning.
> 
> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>

Reviewed-by: Nathan Chancellor <nathan@kernel.org>

I would expect GCC to warn about this as well.

> ---
> 
> To avoid mailbombing on a large number of people, only mailing lists were C/C on the cover.
> See [PATCH 00/20] at: https://lore.kernel.org/all/cover.1637781097.git.mchehab+huawei@kernel.org/
> 
>  drivers/media/dvb-frontends/drxd_hard.c | 8 --------
>  1 file changed, 8 deletions(-)
> 
> diff --git a/drivers/media/dvb-frontends/drxd_hard.c b/drivers/media/dvb-frontends/drxd_hard.c
> index a7eb81df88c2..9860cae65f1c 100644
> --- a/drivers/media/dvb-frontends/drxd_hard.c
> +++ b/drivers/media/dvb-frontends/drxd_hard.c
> @@ -914,44 +914,36 @@ static int DownloadMicrocode(struct drxd_state *state,
>  	u32 Address;
>  	u16 nBlocks;
>  	u16 BlockSize;
> -	u32 offset = 0;
>  	int i, status = 0;
>  
>  	pSrc = (u8 *) pMCImage;
>  	/* We're not using Flags */
>  	/* Flags = (pSrc[0] << 8) | pSrc[1]; */
>  	pSrc += sizeof(u16);
> -	offset += sizeof(u16);
>  	nBlocks = (pSrc[0] << 8) | pSrc[1];
>  	pSrc += sizeof(u16);
> -	offset += sizeof(u16);
>  
>  	for (i = 0; i < nBlocks; i++) {
>  		Address = (pSrc[0] << 24) | (pSrc[1] << 16) |
>  		    (pSrc[2] << 8) | pSrc[3];
>  		pSrc += sizeof(u32);
> -		offset += sizeof(u32);
>  
>  		BlockSize = ((pSrc[0] << 8) | pSrc[1]) * sizeof(u16);
>  		pSrc += sizeof(u16);
> -		offset += sizeof(u16);
>  
>  		/* We're not using Flags */
>  		/* u16 Flags = (pSrc[0] << 8) | pSrc[1]; */
>  		pSrc += sizeof(u16);
> -		offset += sizeof(u16);
>  
>  		/* We're not using BlockCRC */
>  		/* u16 BlockCRC = (pSrc[0] << 8) | pSrc[1]; */
>  		pSrc += sizeof(u16);
> -		offset += sizeof(u16);
>  
>  		status = WriteBlock(state, Address, BlockSize,
>  				    pSrc, DRX_I2C_CLEARCRC);
>  		if (status < 0)
>  			break;
>  		pSrc += BlockSize;
> -		offset += BlockSize;
>  	}
>  
>  	return status;
> -- 
> 2.33.1
> 
>
diff mbox series

Patch

diff --git a/drivers/media/dvb-frontends/drxd_hard.c b/drivers/media/dvb-frontends/drxd_hard.c
index a7eb81df88c2..9860cae65f1c 100644
--- a/drivers/media/dvb-frontends/drxd_hard.c
+++ b/drivers/media/dvb-frontends/drxd_hard.c
@@ -914,44 +914,36 @@  static int DownloadMicrocode(struct drxd_state *state,
 	u32 Address;
 	u16 nBlocks;
 	u16 BlockSize;
-	u32 offset = 0;
 	int i, status = 0;
 
 	pSrc = (u8 *) pMCImage;
 	/* We're not using Flags */
 	/* Flags = (pSrc[0] << 8) | pSrc[1]; */
 	pSrc += sizeof(u16);
-	offset += sizeof(u16);
 	nBlocks = (pSrc[0] << 8) | pSrc[1];
 	pSrc += sizeof(u16);
-	offset += sizeof(u16);
 
 	for (i = 0; i < nBlocks; i++) {
 		Address = (pSrc[0] << 24) | (pSrc[1] << 16) |
 		    (pSrc[2] << 8) | pSrc[3];
 		pSrc += sizeof(u32);
-		offset += sizeof(u32);
 
 		BlockSize = ((pSrc[0] << 8) | pSrc[1]) * sizeof(u16);
 		pSrc += sizeof(u16);
-		offset += sizeof(u16);
 
 		/* We're not using Flags */
 		/* u16 Flags = (pSrc[0] << 8) | pSrc[1]; */
 		pSrc += sizeof(u16);
-		offset += sizeof(u16);
 
 		/* We're not using BlockCRC */
 		/* u16 BlockCRC = (pSrc[0] << 8) | pSrc[1]; */
 		pSrc += sizeof(u16);
-		offset += sizeof(u16);
 
 		status = WriteBlock(state, Address, BlockSize,
 				    pSrc, DRX_I2C_CLEARCRC);
 		if (status < 0)
 			break;
 		pSrc += BlockSize;
-		offset += BlockSize;
 	}
 
 	return status;