linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] media: c8sectpfe: remove redundant assignment to pointer tsin
@ 2021-12-05  0:37 Colin Ian King
  2021-12-07  9:35 ` Patrice CHOTARD
  2021-12-07 12:44 ` Dan Carpenter
  0 siblings, 2 replies; 3+ messages in thread
From: Colin Ian King @ 2021-12-05  0:37 UTC (permalink / raw)
  To: Patrice Chotard, Mauro Carvalho Chehab, linux-arm-kernel, linux-media
  Cc: kernel-janitors, linux-kernel

Pointer tsin is being assigned a value that is never read. The assignment
is redundant and can be removed.

Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
---
 drivers/media/platform/sti/c8sectpfe/c8sectpfe-core.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/drivers/media/platform/sti/c8sectpfe/c8sectpfe-core.c b/drivers/media/platform/sti/c8sectpfe/c8sectpfe-core.c
index 02dc78bd7fab..e1f520903248 100644
--- a/drivers/media/platform/sti/c8sectpfe/c8sectpfe-core.c
+++ b/drivers/media/platform/sti/c8sectpfe/c8sectpfe-core.c
@@ -930,12 +930,8 @@ static int configure_channels(struct c8sectpfei *fei)
 
 	/* iterate round each tsin and configure memdma descriptor and IB hw */
 	for_each_child_of_node(np, child) {
-
-		tsin = fei->channel_data[index];
-
 		ret = configure_memdma_and_inputblock(fei,
 						fei->channel_data[index]);
-
 		if (ret) {
 			dev_err(fei->dev,
 				"configure_memdma_and_inputblock failed\n");
-- 
2.33.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] media: c8sectpfe: remove redundant assignment to pointer tsin
  2021-12-05  0:37 [PATCH] media: c8sectpfe: remove redundant assignment to pointer tsin Colin Ian King
@ 2021-12-07  9:35 ` Patrice CHOTARD
  2021-12-07 12:44 ` Dan Carpenter
  1 sibling, 0 replies; 3+ messages in thread
From: Patrice CHOTARD @ 2021-12-07  9:35 UTC (permalink / raw)
  To: Colin Ian King, Mauro Carvalho Chehab, linux-arm-kernel, linux-media
  Cc: kernel-janitors, linux-kernel

Hi Colin

On 12/5/21 1:37 AM, Colin Ian King wrote:
> Pointer tsin is being assigned a value that is never read. The assignment
> is redundant and can be removed.
> 
> Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
> ---
>  drivers/media/platform/sti/c8sectpfe/c8sectpfe-core.c | 4 ----
>  1 file changed, 4 deletions(-)
> 
> diff --git a/drivers/media/platform/sti/c8sectpfe/c8sectpfe-core.c b/drivers/media/platform/sti/c8sectpfe/c8sectpfe-core.c
> index 02dc78bd7fab..e1f520903248 100644
> --- a/drivers/media/platform/sti/c8sectpfe/c8sectpfe-core.c
> +++ b/drivers/media/platform/sti/c8sectpfe/c8sectpfe-core.c
> @@ -930,12 +930,8 @@ static int configure_channels(struct c8sectpfei *fei)
>  
>  	/* iterate round each tsin and configure memdma descriptor and IB hw */
>  	for_each_child_of_node(np, child) {
> -
> -		tsin = fei->channel_data[index];
> -
>  		ret = configure_memdma_and_inputblock(fei,
>  						fei->channel_data[index]);
> -
>  		if (ret) {
>  			dev_err(fei->dev,
>  				"configure_memdma_and_inputblock failed\n");
> 

Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>

Thanks
Patrice

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] media: c8sectpfe: remove redundant assignment to pointer tsin
  2021-12-05  0:37 [PATCH] media: c8sectpfe: remove redundant assignment to pointer tsin Colin Ian King
  2021-12-07  9:35 ` Patrice CHOTARD
@ 2021-12-07 12:44 ` Dan Carpenter
  1 sibling, 0 replies; 3+ messages in thread
From: Dan Carpenter @ 2021-12-07 12:44 UTC (permalink / raw)
  To: Colin Ian King
  Cc: Patrice Chotard, Mauro Carvalho Chehab, linux-arm-kernel,
	linux-media, kernel-janitors, linux-kernel

On Sun, Dec 05, 2021 at 12:37:45AM +0000, Colin Ian King wrote:
> Pointer tsin is being assigned a value that is never read. The assignment
> is redundant and can be removed.
> 
> Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
> ---
>  drivers/media/platform/sti/c8sectpfe/c8sectpfe-core.c | 4 ----
>  1 file changed, 4 deletions(-)
> 
> diff --git a/drivers/media/platform/sti/c8sectpfe/c8sectpfe-core.c b/drivers/media/platform/sti/c8sectpfe/c8sectpfe-core.c
> index 02dc78bd7fab..e1f520903248 100644
> --- a/drivers/media/platform/sti/c8sectpfe/c8sectpfe-core.c
> +++ b/drivers/media/platform/sti/c8sectpfe/c8sectpfe-core.c
> @@ -930,12 +930,8 @@ static int configure_channels(struct c8sectpfei *fei)
>  
>  	/* iterate round each tsin and configure memdma descriptor and IB hw */
>  	for_each_child_of_node(np, child) {
> -
> -		tsin = fei->channel_data[index];
> -
>  		ret = configure_memdma_and_inputblock(fei,
>  						fei->channel_data[index]);
> -
>  		if (ret) {
>  			dev_err(fei->dev,
>  				"configure_memdma_and_inputblock failed\n");

This function is weird.  So far as I can see instead of looping
for_each_child_of_node() it could just do:

	for (i = 0; i < fei->tsin_count; i++) {

It's equivalent and simpler.

The error handling has a double free as well because
configure_memdma_and_inputblock() calls free_input_block() and the
goto err_unmap does too.  It should be:

	while (--i >= 0)
		free_input_block(fei, fei->channel_data[i]);

I'll send a patch for this tomorrow.

regards,
dan carpenter

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-12-07 12:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-05  0:37 [PATCH] media: c8sectpfe: remove redundant assignment to pointer tsin Colin Ian King
2021-12-07  9:35 ` Patrice CHOTARD
2021-12-07 12:44 ` Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).