Linux-USB Archive mirror
 help / color / mirror / Atom feed
From: Paolo Abeni <pabeni@redhat.com>
To: Rengarajan S <rengarajan.s@microchip.com>,
	woojung.huh@microchip.com,  UNGLinuxDriver@microchip.com,
	davem@davemloft.net, edumazet@google.com,  kuba@kernel.org,
	netdev@vger.kernel.org, linux-usb@vger.kernel.org,
	 linux-kernel@vger.kernel.org
Subject: Re: [PATCH net v1] lan78xx: Fix crash with multiple device attach
Date: Mon, 06 May 2024 11:38:29 +0200	[thread overview]
Message-ID: <1706dd2a3d24462780599f57e379fa2a1e8e15ac.camel@redhat.com> (raw)
In-Reply-To: <20240502045748.37627-1-rengarajan.s@microchip.com>

On Thu, 2024-05-02 at 10:27 +0530, Rengarajan S wrote:
> After the first device(MAC + PHY) is attached, the corresponding
> fixup gets registered and before it is unregistered next device
> is attached causing the dev pointer of second device to be NULL.
> Fixed the issue with multiple PHY attach by unregistering PHY
> at the end of probe. Removed the unregistration during phy_init
> since the handling has been taken care in probe.

The above description is unclear to me. Could you please list the exact
sequence of events/calls that lead to the problem?

> Fixes: 89b36fb5e532 ("lan78xx: Lan7801 Support for Fixed PHY")
> Signed-off-by: Rengarajan S <rengarajan.s@microchip.com>
> ---
> 
>  drivers/net/usb/lan78xx.c | 16 +++++++++-------
>  1 file changed, 9 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/net/usb/lan78xx.c b/drivers/net/usb/lan78xx.c
> index 5add4145d..3ec79620f 100644
> --- a/drivers/net/usb/lan78xx.c
> +++ b/drivers/net/usb/lan78xx.c
> @@ -2383,14 +2383,8 @@ static int lan78xx_phy_init(struct lan78xx_net *dev)
>  		netdev_err(dev->net, "can't attach PHY to %s\n",
>  			   dev->mdiobus->id);
>  		if (dev->chipid == ID_REV_CHIP_ID_7801_) {
> -			if (phy_is_pseudo_fixed_link(phydev)) {
> +			if (phy_is_pseudo_fixed_link(phydev))
>  				fixed_phy_unregister(phydev);
> -			} else {
> -				phy_unregister_fixup_for_uid(PHY_KSZ9031RNX,
> -							     0xfffffff0);
> -				phy_unregister_fixup_for_uid(PHY_LAN8835,
> -							     0xfffffff0);
> -			}
>  		}
>  		return -EIO;
>  	}
> @@ -4458,6 +4452,14 @@ static int lan78xx_probe(struct usb_interface *intf,
>  	pm_runtime_set_autosuspend_delay(&udev->dev,
>  					 DEFAULT_AUTOSUSPEND_DELAY);
>  
> +	/* Unregistering Fixup to avoid crash with multiple device
> +	 * attach.
> +	 */
> +	phy_unregister_fixup_for_uid(PHY_KSZ9031RNX,
> +				     0xfffffff0);
> +	phy_unregister_fixup_for_uid(PHY_LAN8835,
> +				     0xfffffff0);
> +

Minor nit: the above 2 statments can now fit a single line each.

Thanks,

Paolo


  parent reply	other threads:[~2024-05-06  9:38 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-02  4:57 [PATCH net v1] lan78xx: Fix crash with multiple device attach Rengarajan S
2024-05-02  5:16 ` Greg KH
2024-05-06  9:38 ` Paolo Abeni [this message]
2024-05-07  5:07   ` Rengarajan.S
2024-05-08  1:23     ` 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=1706dd2a3d24462780599f57e379fa2a1e8e15ac.camel@redhat.com \
    --to=pabeni@redhat.com \
    --cc=UNGLinuxDriver@microchip.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=rengarajan.s@microchip.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: 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 read-only IMAP folder(s) and NNTP newsgroup(s).