netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Simon Horman <horms@kernel.org>
To: Wentao Liang <vulab@iscas.ac.cn>
Cc: anthony.l.nguyen@intel.com, przemyslaw.kitszel@intel.com,
	andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@google.com,
	kuba@kernel.org, pabeni@redhat.com,
	intel-wired-lan@lists.osuosl.org, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH] e1000e: Add error handling for e1e_rphy_locked()
Date: Mon, 7 Apr 2025 16:02:10 +0100	[thread overview]
Message-ID: <20250407150210.GM395307@horms.kernel.org> (raw)
In-Reply-To: <20250407034155.1396-1-vulab@iscas.ac.cn>

On Mon, Apr 07, 2025 at 11:41:54AM +0800, Wentao Liang wrote:
> The e1000_suspend_workarounds_ich8lan() calls e1e_rphy_locked to disable
> the SMB release, but does not check its return value. A proper
> implementation can be found in e1000_resume_workarounds_pchlan() from
> /source/drivers/net/ethernet/intel/e1000e/ich8lan.c.
> 
> Add an error check for e1e_rphy_locked(). Log the error message and jump
> to 'release' label if the e1e_rphy_locked() fails.
> 
> Fixes: 2fbe4526e5aa ("e1000e: initial support for i217")
> Cc: stable@vger.kernel.org # v3.5+
> Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
> ---
>  drivers/net/ethernet/intel/e1000e/ich8lan.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/intel/e1000e/ich8lan.c b/drivers/net/ethernet/intel/e1000e/ich8lan.c
> index 2f9655cf5dd9..d16e3aa50809 100644
> --- a/drivers/net/ethernet/intel/e1000e/ich8lan.c
> +++ b/drivers/net/ethernet/intel/e1000e/ich8lan.c
> @@ -5497,7 +5497,11 @@ void e1000_suspend_workarounds_ich8lan(struct e1000_hw *hw)
>  			e1e_wphy_locked(hw, I217_SxCTRL, phy_reg);
>  
>  			/* Disable the SMB release on LCD reset. */
> -			e1e_rphy_locked(hw, I217_MEMPWR, &phy_reg);
> +			ret_val = e1e_rphy_locked(hw, I217_MEMPWR, &phy_reg);
> +			if (ret_val) {
> +				e_dbg("Fail to Disable the SMB release on LCD reset.");
> +				goto release;
> +			}
>  			phy_reg &= ~I217_MEMPWR_DISABLE_SMB_RELEASE;
>  			e1e_wphy_locked(hw, I217_MEMPWR, phy_reg);
>  		}

Hi,

The next few lines of this function look like this:

		/* Enable MTA to reset for Intel Rapid Start Technology
		 * Support
		 */
		e1e_rphy_locked(hw, I217_CGFREG, &phy_reg);
		phy_reg |= I217_CGFREG_ENABLE_MTA_RESET;
		e1e_wphy_locked(hw, I217_CGFREG, phy_reg);

And I think that to be consistent with e1000_resume_workarounds_pchlan()
the return value of the above call to e1e_rphy_locked() should also be
checked.

However, I am not at all sure if the current absence of error checking is
intended as part of the logic flow, or if these are oversights.

Have you observed any run-time problems with this code?

I would naively expect that the i217 is or was a widely used device.  And
this code seems to have been around for a well over 10 years in it's
current form. Which makes me thing we should tread carefully when changing
it.


      reply	other threads:[~2025-04-07 15:02 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-07  3:41 [PATCH] e1000e: Add error handling for e1e_rphy_locked() Wentao Liang
2025-04-07 15:02 ` Simon Horman [this message]

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=20250407150210.GM395307@horms.kernel.org \
    --to=horms@kernel.org \
    --cc=andrew+netdev@lunn.ch \
    --cc=anthony.l.nguyen@intel.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.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 \
    --cc=przemyslaw.kitszel@intel.com \
    --cc=stable@vger.kernel.org \
    --cc=vulab@iscas.ac.cn \
    /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;
as well as URLs for NNTP newsgroup(s).