public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Colin Ian King <colin.i.king@gmail.com>
Cc: Patrice Chotard <patrice.chotard@foss.st.com>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	linux-arm-kernel@lists.infradead.org,
	linux-media@vger.kernel.org, kernel-janitors@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] media: c8sectpfe: remove redundant assignment to pointer tsin
Date: Tue, 7 Dec 2021 15:44:32 +0300	[thread overview]
Message-ID: <20211207124432.GE1956@kadam> (raw)
In-Reply-To: <20211205003745.227491-1-colin.i.king@gmail.com>

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

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

      parent reply	other threads:[~2021-12-07 12:48 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211207124432.GE1956@kadam \
    --to=dan.carpenter@oracle.com \
    --cc=colin.i.king@gmail.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=patrice.chotard@foss.st.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox