[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20211207124432.GE1956@kadam>
Date: Tue, 7 Dec 2021 15:44:32 +0300
From: Dan Carpenter <dan.carpenter@...cle.com>
To: Colin Ian King <colin.i.king@...il.com>
Cc: Patrice Chotard <patrice.chotard@...s.st.com>,
Mauro Carvalho Chehab <mchehab@...nel.org>,
linux-arm-kernel@...ts.infradead.org, linux-media@...r.kernel.org,
kernel-janitors@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] media: c8sectpfe: remove redundant assignment to pointer
tsin
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@...il.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
Powered by blists - more mailing lists