From: Jesse Brandeburg <jesse.brandeburg@intel.com>
To: lily <floridsleeves@gmail.com>,
<intel-wired-lan@lists.osuosl.org>, <netdev@vger.kernel.org>,
<linux-kernel@vger.kernel.org>
Cc: <anthony.l.nguyen@intel.com>, <davem@davemloft.net>,
<edumazet@google.com>, <kuba@kernel.org>, <pabeni@redhat.com>
Subject: Re: [PATCH v1] drivers/net/ethernet: check return value of e1e_rphy()
Date: Tue, 23 Aug 2022 08:19:39 -0700 [thread overview]
Message-ID: <0056a39d-d7dc-34ea-3a71-6d5d3835c2d5@intel.com> (raw)
In-Reply-To: <20220823060200.1452663-1-floridsleeves@gmail.com>
On 8/22/2022 11:02 PM, lily wrote:
> e1e_rphy() could return error value, which need to be checked.
Thanks for having a look at the e1000e driver. Was there some bug you
found or is this just a fix based on a tool or observation?
If a tool was used, what tool?
For networking patches please follow the guidance at
https://www.kernel.org/doc/html/latest/process/maintainer-netdev.html
> Signed-off-by: Li Zhong <floridsleeves@gmail.com>
> ---
> drivers/net/ethernet/intel/e1000e/phy.c | 14 +++++++++++---
> 1 file changed, 11 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/net/ethernet/intel/e1000e/phy.c b/drivers/net/ethernet/intel/e1000e/phy.c
> index fd07c3679bb1..15ac302fdee0 100644
> --- a/drivers/net/ethernet/intel/e1000e/phy.c
> +++ b/drivers/net/ethernet/intel/e1000e/phy.c
> @@ -2697,9 +2697,12 @@ static s32 e1000_access_phy_wakeup_reg_bm(struct e1000_hw *hw, u32 offset,
> void e1000_power_up_phy_copper(struct e1000_hw *hw)
> {
> u16 mii_reg = 0;
> + int ret;
>
> /* The PHY will retain its settings across a power down/up cycle */
> - e1e_rphy(hw, MII_BMCR, &mii_reg);
> + ret = e1e_rphy(hw, MII_BMCR, &mii_reg);
> + if (ret)
> + return ret;
Can't return value to a void declared function, did you even compile
test this?
Maybe it should be like:
if (ret) {
// this is psuedo code
dev_warn(..., "PHY read failed during power up\n");
return;
}
> mii_reg &= ~BMCR_PDOWN;
> e1e_wphy(hw, MII_BMCR, mii_reg);
> }
> @@ -2715,9 +2718,12 @@ void e1000_power_up_phy_copper(struct e1000_hw *hw)
> void e1000_power_down_phy_copper(struct e1000_hw *hw)
> {
> u16 mii_reg = 0;
> + int ret;
>
> /* The PHY will retain its settings across a power down/up cycle */
> - e1e_rphy(hw, MII_BMCR, &mii_reg);
> + ret = e1e_rphy(hw, MII_BMCR, &mii_reg);
> + if (ret)
> + return ret;
same here.
> mii_reg |= BMCR_PDOWN;
> e1e_wphy(hw, MII_BMCR, mii_reg);
> usleep_range(1000, 2000);
> @@ -3037,7 +3043,9 @@ s32 e1000_link_stall_workaround_hv(struct e1000_hw *hw)
> return 0;
>
> /* Do not apply workaround if in PHY loopback bit 14 set */
> - e1e_rphy(hw, MII_BMCR, &data);
> + ret_val = e1e_rphy(hw, MII_BMCR, &data);
> + if (ret_val)
> + return ret_val;
> if (data & BMCR_LOOPBACK)
> return 0;
>
Did any of the callers of the above function care about the return code
being an error value? This has been like this for a long time...
next prev parent reply other threads:[~2022-08-23 17:37 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-23 6:02 lily
2022-08-23 15:19 ` Jesse Brandeburg [this message]
2022-08-26 5:42 ` Li Zhong
2022-08-23 22:23 ` [Intel-wired-lan] " Paul Menzel
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=0056a39d-d7dc-34ea-3a71-6d5d3835c2d5@intel.com \
--to=jesse.brandeburg@intel.com \
--cc=anthony.l.nguyen@intel.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=floridsleeves@gmail.com \
--cc=intel-wired-lan@lists.osuosl.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--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 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®