From: Mateusz Polchlopek <mateusz.polchlopek@intel.com>
To: Breno Leitao <leitao@debian.org>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>,
"Paolo Abeni" <pabeni@redhat.com>,
Simon Horman <horms@kernel.org>,
Nicolas Dichtel <nicolas.dichtel@6wind.com>
Cc: <netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH net-next] net: Remove redundant variable declaration in __dev_change_flags()
Date: Fri, 14 Feb 2025 14:27:16 +0100 [thread overview]
Message-ID: <d556d7be-e3c5-45c7-930b-386576f0e2d1@intel.com> (raw)
In-Reply-To: <20250214-old_flags-v1-1-29096b9399a9@debian.org>
On 2/14/2025 1:47 PM, Breno Leitao wrote:
> The old_flags variable is declared twice in __dev_change_flags(),
> causing a shadow variable warning. This patch fixes the issue by
> removing the redundant declaration, reusing the existing old_flags
> variable instead.
>
> net/core/dev.c:9225:16: warning: declaration shadows a local variable [-Wshadow]
> 9225 | unsigned int old_flags = dev->flags;
> | ^
> net/core/dev.c:9185:15: note: previous declaration is here
> 9185 | unsigned int old_flags = dev->flags;
> | ^
> 1 warning generated.
>
> This change has no functional impact on the code, as the inner variable
> does not affect the outer one. The fix simply eliminates the unnecessary
> declaration and resolves the warning.
>
> Fixes: 991fb3f74c142e ("dev: always advertise rx_flags changes via netlink")
> Signed-off-by: Breno Leitao <leitao@debian.org>
> ---
> net/core/dev.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/net/core/dev.c b/net/core/dev.c
> index d5ab9a4b318ea4926c200ef20dae01eaafa18c6b..cd2474a138201e6ee86acf39ca425d57d8d2e9b4 100644
> --- a/net/core/dev.c
> +++ b/net/core/dev.c
> @@ -9182,7 +9182,7 @@ int __dev_change_flags(struct net_device *dev, unsigned int flags,
>
> if ((flags ^ dev->gflags) & IFF_PROMISC) {
> int inc = (flags & IFF_PROMISC) ? 1 : -1;
> - unsigned int old_flags = dev->flags;
> + old_flags = dev->flags;
>
> dev->gflags ^= IFF_PROMISC;
>
>
> ---
> base-commit: 7a7e0197133d18cfd9931e7d3a842d0f5730223f
> change-id: 20250214-old_flags-528fe052471c
>
> Best regards,
Good change but it has to be tagged to net and not net-next. Please
resend but add also my RB tag, thanks.
Reviewed-by: Mateusz Polchlopek <mateusz.polchlopek@intel.com>
next prev parent reply other threads:[~2025-02-14 13:27 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-14 12:47 [PATCH net-next] net: Remove redundant variable declaration in __dev_change_flags() Breno Leitao
2025-02-14 13:27 ` Mateusz Polchlopek [this message]
2025-02-14 13:33 ` Andrew Lunn
2025-02-14 14:21 ` Breno Leitao
2025-02-14 15:02 ` Andrew Lunn
2025-02-14 16:09 ` Breno Leitao
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=d556d7be-e3c5-45c7-930b-386576f0e2d1@intel.com \
--to=mateusz.polchlopek@intel.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=leitao@debian.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=nicolas.dichtel@6wind.com \
--cc=pabeni@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.