mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Tommaso Merciai <tommaso.merciai@amarulasolutions.com>
To: Colin Ian King <colin.i.king@gmail.com>
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>,
	Cai Huoqing <cai.huoqing@linux.dev>,
	linux-media@vger.kernel.org, kernel-janitors@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] media: dvb-core: remove variable n, turn for-loop to while-loop
Date: Fri, 28 Oct 2022 17:06:26 +0200	[thread overview]
Message-ID: <20221028150626.GA165737@tom-ThinkPad-T14s-Gen-2i> (raw)
In-Reply-To: <20221024142954.2162920-1-colin.i.king@gmail.com>

Hi Colin,

On Mon, Oct 24, 2022 at 03:29:54PM +0100, Colin Ian King wrote:
> Variable n is just being incremented and it's never used
> anywhere else. The variable and the increment are redundant so
> remove it. This allows the for-loop to be replaced with a
> while-loop.
> 
> Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
> ---
>  drivers/media/dvb-core/dvb_demux.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/media/dvb-core/dvb_demux.c b/drivers/media/dvb-core/dvb_demux.c
> index 83cc32ad7e12..398c86279b5b 100644
> --- a/drivers/media/dvb-core/dvb_demux.c
> +++ b/drivers/media/dvb-core/dvb_demux.c
> @@ -233,7 +233,7 @@ static int dvb_dmx_swfilter_section_copy_dump(struct dvb_demux_feed *feed,
>  {
>  	struct dvb_demux *demux = feed->demux;
>  	struct dmx_section_feed *sec = &feed->feed.sec;
> -	u16 limit, seclen, n;
> +	u16 limit, seclen;
>  
>  	if (sec->tsfeedp >= DMX_MAX_SECFEED_SIZE)
>  		return 0;
> @@ -262,7 +262,7 @@ static int dvb_dmx_swfilter_section_copy_dump(struct dvb_demux_feed *feed,
>  	/* to be sure always set secbuf */
>  	sec->secbuf = sec->secbuf_base + sec->secbufp;
>  
> -	for (n = 0; sec->secbufp + 2 < limit; n++) {
> +	while (sec->secbufp + 2 < limit) {
>  		seclen = section_length(sec->secbuf);
>  		if (seclen <= 0 || seclen > DMX_MAX_SECTION_SIZE
>  		    || seclen + sec->secbufp > limit)
> -- 
> 2.37.3
> 

Looks good to me.
We save some space into function stack :)

Reviewed-by: Tommaso Merciai <tommaso.merciai@amarulasolutions.com>

Regards,
Tommaso


-- 
Tommaso Merciai
Embedded Linux Engineer
tommaso.merciai@amarulasolutions.com
__________________________________

Amarula Solutions SRL
Via Le Canevare 30, 31100 Treviso, Veneto, IT
T. +39 042 243 5310
info@amarulasolutions.com
www.amarulasolutions.com

      reply	other threads:[~2022-10-28 15:06 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-24 14:29 Colin Ian King
2022-10-28 15:06 ` Tommaso Merciai [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=20221028150626.GA165737@tom-ThinkPad-T14s-Gen-2i \
    --to=tommaso.merciai@amarulasolutions.com \
    --cc=cai.huoqing@linux.dev \
    --cc=colin.i.king@gmail.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    /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

all inboxes | Powered by JetHome®