mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
Cc: pmladek@suse.com, rostedt@goodmis.org, linux@rasmusvillemoes.dk,
	senozhatsky@chromium.org, linux-kernel@vger.kernel.org,
	Abaci Robot <abaci@linux.alibaba.com>
Subject: Re: [PATCH] lib/vsprintf: Remove redundant code
Date: Wed, 18 Oct 2023 15:56:14 +0300	[thread overview]
Message-ID: <ZS/V7uS/7cGMpDJD@smile.fi.intel.com> (raw)
In-Reply-To: <20231018064817.86721-1-jiapeng.chong@linux.alibaba.com>

On Wed, Oct 18, 2023 at 02:48:17PM +0800, Jiapeng Chong wrote:
> When variable needcolon is assigned a value of false, it must be
> assigned a value of true later on, which is redundant code.
> 
> lib/vsprintf.c:1411:4: warning: Value stored to 'needcolon' is never read.

...

> @@ -1406,10 +1406,9 @@ char *ip6_compressed_string(char *p, const char *addr)
>  			i += longest - 1;
>  			continue;
>  		}
> -		if (needcolon) {
> +		if (needcolon)
>  			*p++ = ':';
> -			needcolon = false;
> -		}
> +
>  		/* hex u16 without leading 0s */
>  		word = ntohs(in6.s6_addr16[i]);
>  		hi = word >> 8;

Logically you may remove then the assignment to true as well.

But I would double check if it's not a continue missing somewhere or so.

-- 
With Best Regards,
Andy Shevchenko



  reply	other threads:[~2023-10-18 12:56 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-18  6:48 Jiapeng Chong
2023-10-18 12:56 ` Andy Shevchenko [this message]
2023-10-19 11:51 ` Rasmus Villemoes
2023-10-19 12:21   ` Andy Shevchenko
2023-10-19 13:21 ` Petr Mladek

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=ZS/V7uS/7cGMpDJD@smile.fi.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=abaci@linux.alibaba.com \
    --cc=jiapeng.chong@linux.alibaba.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@rasmusvillemoes.dk \
    --cc=pmladek@suse.com \
    --cc=rostedt@goodmis.org \
    --cc=senozhatsky@chromium.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®