From: Jacob Keller <jacob.e.keller@intel.com>
To: Qianfeng Rong <rongqianfeng@vivo.com>,
Shyam Sundar S K <Shyam-sundar.S-k@amd.com>,
Andrew Lunn <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
"Jakub Kicinski" <kuba@kernel.org>,
Paolo Abeni <pabeni@redhat.com>, <netdev@vger.kernel.org>,
<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] amd-xgbe: Use int type to store negative error codes
Date: Wed, 27 Aug 2025 15:20:04 -0700 [thread overview]
Message-ID: <47ed10fc-4445-44ba-be79-dc90b7e7d0e3@intel.com> (raw)
In-Reply-To: <20250826142159.525059-1-rongqianfeng@vivo.com>
[-- Attachment #1.1: Type: text/plain, Size: 1767 bytes --]
On 8/26/2025 7:21 AM, Qianfeng Rong wrote:
> Use int instead of unsigned int for the 'ret' variable to store return
> values from functions that either return zero on success or negative error
> codes on failure. Storing negative error codes in an unsigned int causes
> no runtime issues, but it's ugly as pants, Change 'ret' from unsigned int
> to int type - this change has no runtime impact.
>
Right, unless you have some sort of signed/unsigned comparison of the
value where you check for ret < 0 for example. Since you just assign to
the local unsigned ret, then return the value as a signed int, this
indeed has no functional change.
> Signed-off-by: Qianfeng Rong <rongqianfeng@vivo.com>
> ---
> drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c | 2 +-
> drivers/net/ethernet/amd/xgbe/xgbe-i2c.c | 2 +-
> drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c | 2 +-
> 3 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c b/drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c
> index 35d73306a2d6..b6e1b67a2d0e 100644
> --- a/drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c
> +++ b/drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c
> @@ -464,7 +464,7 @@ static int xgbe_set_rxfh(struct net_device *netdev,
> {
> struct xgbe_prv_data *pdata = netdev_priv(netdev);
> struct xgbe_hw_if *hw_if = &pdata->hw_if;
> - unsigned int ret;
> + int ret;
>
Looks like this was there from when this was first introduced.
Interestingly, that very same commit f6ac862845bb ("amd-xgbe: Add
receive side scaling ethtool support") used signed integers for the
called functions that assign into ret.
Good to clean this mistake up.
Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 236 bytes --]
next prev parent reply other threads:[~2025-08-27 22:20 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-26 14:21 Qianfeng Rong
2025-08-27 22:20 ` Jacob Keller [this message]
2025-08-28 1:10 ` patchwork-bot+netdevbpf
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=47ed10fc-4445-44ba-be79-dc90b7e7d0e3@intel.com \
--to=jacob.e.keller@intel.com \
--cc=Shyam-sundar.S-k@amd.com \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=rongqianfeng@vivo.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 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®