mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: Matheus Alves de Almeida <matheus.aalmeida@inf.ufrgs.br>
Cc: Heiner Kallweit <hkallweit1@gmail.com>,
	nic_swsd@realtek.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 net-next 3/3] r8169: release firmware on application failure
Date: Wed, 16 Sep 2026 20:42:28 +0200	[thread overview]
Message-ID: <fe23c6bb-2cdf-4641-aae8-25b03b38be42@lunn.ch> (raw)
In-Reply-To: <20260916152444.167196-4-matheus.aalmeida@inf.ufrgs.br>

On Wed, Sep 16, 2026 at 12:24:44PM -0300, Matheus Alves de Almeida wrote:
> After an rtl_fw_write_firmware() failure, r8169_apply_firmware() does
> not release the firmware. A TODO notes that it should be released
> in this case.
> 
> Release the firmware on failure and remove the TODO.
> 
> Signed-off-by: Matheus Alves de Almeida <matheus.aalmeida@inf.ufrgs.br>
> ---
>  drivers/net/ethernet/realtek/r8169_main.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/ethernet/realtek/r8169_main.c b/drivers/net/ethernet/realtek/r8169_main.c
> index 3c37c5a6c..c54423cd2 100644
> --- a/drivers/net/ethernet/realtek/r8169_main.c
> +++ b/drivers/net/ethernet/realtek/r8169_main.c
> @@ -2596,12 +2596,14 @@ void r8169_apply_firmware(struct rtl8169_private *tp)
>  {
>  	int val;
>  
> -	/* TODO: release firmware if rtl_fw_write_firmware signals failure. */
>  	if (tp->rtl_fw) {
> -		rtl_fw_write_firmware(tp, tp->rtl_fw);
> +		int rc = rtl_fw_write_firmware(tp, tp->rtl_fw);
>  		/* At least one firmware doesn't reset tp->ocp_base. */
>  		tp->ocp_base = OCP_STD_PHY_BASE;
>  
> +		if (rc < 0)
> +			rtl_release_firmware(tp);
> +
>  		/* PHY soft reset may still be in progress */
>  		if (tp->phydev)
>  			phy_read_poll_timeout(tp->phydev, MII_BMCR, val,

If the firmware cannot be written, is the device dead? Should this
return an error, so the caller can abort the probe?

       Andrew

  reply	other threads:[~2026-09-16 18:42 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-16 15:24 [PATCH net-next 0/3] r8169: handle firmware application errors Matheus Alves de Almeida
2026-09-16 15:24 ` [PATCH net-next 1/3] r8169: propagate errors from PHY write operations Matheus Alves de Almeida
2026-09-16 18:38   ` Andrew Lunn
2026-09-16 21:10     ` Matheus Alves de Almeida
2026-09-16 21:14       ` Andrew Lunn
2026-09-16 21:19         ` Matheus Alves de Almeida
2026-09-16 15:24 ` [PATCH net-next 2/3] r8169: propagate firmware access errors Matheus Alves de Almeida
2026-09-16 15:24 ` [PATCH net-next 3/3] r8169: release firmware on application failure Matheus Alves de Almeida
2026-09-16 18:42   ` Andrew Lunn [this message]
2026-09-16 21:15     ` Matheus Alves de Almeida
2026-09-16 22:02       ` Andrew Lunn
2026-09-16 22:21         ` Matheus Alves de Almeida
2026-09-17  2:19         ` Matheus Alves de Almeida
2026-09-17 12:14           ` Andrew Lunn

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=fe23c6bb-2cdf-4641-aae8-25b03b38be42@lunn.ch \
    --to=andrew@lunn.ch \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=hkallweit1@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=matheus.aalmeida@inf.ufrgs.br \
    --cc=netdev@vger.kernel.org \
    --cc=nic_swsd@realtek.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 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®