From: Anders Roxell <anders.roxell@linaro.org> To: stable@vger.kernel.org Cc: linux-kernel@vger.kernel.org, woojung.huh@microchip.com, UNGLinuxDriver@microchip.com, davem@davemloft.net, netdev@vger.kernel.org, linux-usb@vger.kernel.org, clang-built-linux@googlegroups.com, ulli.kroll@googlemail.com, linux@armlinux.org.uk, linux-arm-kernel@lists.infradead.org, amitkarwar@gmail.com, nishants@marvell.com, gbhat@marvell.com, huxinming820@gmail.com, kvalo@codeaurora.org, linux-wireless@vger.kernel.org, rostedt@goodmis.org, mingo@redhat.com, dmitry.torokhov@gmail.com, ndesaulniers@google.com, nathan@kernel.org, linux-input@vger.kernel.org, Nathan Chancellor <natechancellor@gmail.com>, Anders Roxell <anders.roxell@linaro.org> Subject: [PATCH 4.19 1/6] net: lan78xx: Avoid unnecessary self assignment Date: Fri, 17 Dec 2021 15:41:14 +0100 [thread overview] Message-ID: <20211217144119.2538175-2-anders.roxell@linaro.org> (raw) In-Reply-To: <20211217144119.2538175-1-anders.roxell@linaro.org> From: Nathan Chancellor <natechancellor@gmail.com> commit 94e7c844990f0db92418586b107be135b4963b66 upstream. Clang warns when a variable is assigned to itself. drivers/net/usb/lan78xx.c:940:11: warning: explicitly assigning value of variable of type 'u32' (aka 'unsigned int') to itself [-Wself-assign] offset = offset; ~~~~~~ ^ ~~~~~~ 1 warning generated. Reorder the if statement to acheive the same result and avoid a self assignment warning. Link: https://github.com/ClangBuiltLinux/linux/issues/129 Signed-off-by: Nathan Chancellor <natechancellor@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Anders Roxell <anders.roxell@linaro.org> --- drivers/net/usb/lan78xx.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/net/usb/lan78xx.c b/drivers/net/usb/lan78xx.c index b328207c0455..f438be83d259 100644 --- a/drivers/net/usb/lan78xx.c +++ b/drivers/net/usb/lan78xx.c @@ -945,11 +945,9 @@ static int lan78xx_read_otp(struct lan78xx_net *dev, u32 offset, ret = lan78xx_read_raw_otp(dev, 0, 1, &sig); if (ret == 0) { - if (sig == OTP_INDICATOR_1) - offset = offset; - else if (sig == OTP_INDICATOR_2) + if (sig == OTP_INDICATOR_2) offset += 0x100; - else + else if (sig != OTP_INDICATOR_1) ret = -EINVAL; if (!ret) ret = lan78xx_read_raw_otp(dev, offset, length, data); -- 2.34.1
WARNING: multiple messages have this Message-ID (diff)
From: Anders Roxell <anders.roxell@linaro.org> To: stable@vger.kernel.org Cc: linux-kernel@vger.kernel.org, woojung.huh@microchip.com, UNGLinuxDriver@microchip.com, davem@davemloft.net, netdev@vger.kernel.org, linux-usb@vger.kernel.org, clang-built-linux@googlegroups.com, ulli.kroll@googlemail.com, linux@armlinux.org.uk, linux-arm-kernel@lists.infradead.org, amitkarwar@gmail.com, nishants@marvell.com, gbhat@marvell.com, huxinming820@gmail.com, kvalo@codeaurora.org, linux-wireless@vger.kernel.org, rostedt@goodmis.org, mingo@redhat.com, dmitry.torokhov@gmail.com, ndesaulniers@google.com, nathan@kernel.org, linux-input@vger.kernel.org, Nathan Chancellor <natechancellor@gmail.com>, Anders Roxell <anders.roxell@linaro.org> Subject: [PATCH 4.19 1/6] net: lan78xx: Avoid unnecessary self assignment Date: Fri, 17 Dec 2021 15:41:14 +0100 [thread overview] Message-ID: <20211217144119.2538175-2-anders.roxell@linaro.org> (raw) In-Reply-To: <20211217144119.2538175-1-anders.roxell@linaro.org> From: Nathan Chancellor <natechancellor@gmail.com> commit 94e7c844990f0db92418586b107be135b4963b66 upstream. Clang warns when a variable is assigned to itself. drivers/net/usb/lan78xx.c:940:11: warning: explicitly assigning value of variable of type 'u32' (aka 'unsigned int') to itself [-Wself-assign] offset = offset; ~~~~~~ ^ ~~~~~~ 1 warning generated. Reorder the if statement to acheive the same result and avoid a self assignment warning. Link: https://github.com/ClangBuiltLinux/linux/issues/129 Signed-off-by: Nathan Chancellor <natechancellor@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Anders Roxell <anders.roxell@linaro.org> --- drivers/net/usb/lan78xx.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/net/usb/lan78xx.c b/drivers/net/usb/lan78xx.c index b328207c0455..f438be83d259 100644 --- a/drivers/net/usb/lan78xx.c +++ b/drivers/net/usb/lan78xx.c @@ -945,11 +945,9 @@ static int lan78xx_read_otp(struct lan78xx_net *dev, u32 offset, ret = lan78xx_read_raw_otp(dev, 0, 1, &sig); if (ret == 0) { - if (sig == OTP_INDICATOR_1) - offset = offset; - else if (sig == OTP_INDICATOR_2) + if (sig == OTP_INDICATOR_2) offset += 0x100; - else + else if (sig != OTP_INDICATOR_1) ret = -EINVAL; if (!ret) ret = lan78xx_read_raw_otp(dev, offset, length, data); -- 2.34.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2021-12-17 14:41 UTC|newest] Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-12-17 14:41 [PATCH 4.19 0/6] fix warning and errors on arm built with clang Anders Roxell 2021-12-17 14:41 ` Anders Roxell 2021-12-17 14:41 ` Anders Roxell [this message] 2021-12-17 14:41 ` [PATCH 4.19 1/6] net: lan78xx: Avoid unnecessary self assignment Anders Roxell 2021-12-17 14:41 ` [PATCH 4.19 2/6] ARM: 8805/2: remove unneeded naked function usage Anders Roxell 2021-12-17 14:41 ` Anders Roxell 2021-12-17 14:41 ` [PATCH 4.19 3/6] mwifiex: Remove unnecessary braces from HostCmd_SET_SEQ_NO_BSS_INFO Anders Roxell 2021-12-17 14:41 ` Anders Roxell 2021-12-20 10:56 ` Greg KH 2021-12-20 10:56 ` Greg KH 2021-12-20 12:13 ` Joe Perches 2021-12-20 12:13 ` Joe Perches 2021-12-20 14:00 ` David Laight 2021-12-20 14:00 ` David Laight 2021-12-17 14:41 ` [PATCH 4.19 4/6] ARM: 8800/1: use choice for kernel unwinders Anders Roxell 2021-12-17 14:41 ` Anders Roxell 2021-12-17 14:41 ` [PATCH 4.19 5/6] ARM: 8788/1: ftrace: remove old mcount support Anders Roxell 2021-12-17 14:41 ` Anders Roxell 2021-12-20 10:57 ` Greg KH 2021-12-20 10:57 ` Greg KH 2022-01-11 20:58 ` Stefan Agner 2022-01-11 20:58 ` Stefan Agner 2022-01-11 21:04 ` Nick Desaulniers 2022-01-11 21:04 ` Nick Desaulniers 2021-12-17 14:41 ` [PATCH 4.19 6/6] Input: touchscreen - avoid bitwise vs logical OR warning Anders Roxell 2021-12-17 14:41 ` Anders Roxell 2021-12-20 10:59 ` Greg KH 2021-12-20 10:59 ` Greg KH 2021-12-21 12:24 ` Anders Roxell 2021-12-21 12:24 ` Anders Roxell
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=20211217144119.2538175-2-anders.roxell@linaro.org \ --to=anders.roxell@linaro.org \ --cc=UNGLinuxDriver@microchip.com \ --cc=amitkarwar@gmail.com \ --cc=clang-built-linux@googlegroups.com \ --cc=davem@davemloft.net \ --cc=dmitry.torokhov@gmail.com \ --cc=gbhat@marvell.com \ --cc=huxinming820@gmail.com \ --cc=kvalo@codeaurora.org \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=linux-input@vger.kernel.org \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-usb@vger.kernel.org \ --cc=linux-wireless@vger.kernel.org \ --cc=linux@armlinux.org.uk \ --cc=mingo@redhat.com \ --cc=natechancellor@gmail.com \ --cc=nathan@kernel.org \ --cc=ndesaulniers@google.com \ --cc=netdev@vger.kernel.org \ --cc=nishants@marvell.com \ --cc=rostedt@goodmis.org \ --cc=stable@vger.kernel.org \ --cc=ulli.kroll@googlemail.com \ --cc=woojung.huh@microchip.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: linkBe 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.