From: Simon Horman <horms@kernel.org>
To: Yi Yang <yiyang13@huawei.com>
Cc: davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
pabeni@redhat.com, linux-usb@vger.kernel.org,
netdev@vger.kernel.org, wangweiyang2@huawei.com
Subject: Re: [PATCH -next] net: usb: asix: Add check for usbnet_get_endpoints
Date: Wed, 3 Apr 2024 11:53:29 +0100 [thread overview]
Message-ID: <20240403105329.GV26556@kernel.org> (raw)
In-Reply-To: <20240402113048.873130-1-yiyang13@huawei.com>
On Tue, Apr 02, 2024 at 11:30:48AM +0000, Yi Yang wrote:
> Add check for usbnet_get_endpoints() and return the error if it fails
> in order to transfer the error.
>
> Signed-off-by: Yi Yang <yiyang13@huawei.com>
Hi,
I am wondering if this is a fix for a user-visible problem and as such
should:
1. Be targeted at net
2. Have a Fixes tag
3. CC stable
See: https://docs.kernel.org/process/maintainer-netdev.html
> ---
> drivers/net/usb/asix_devices.c | 20 +++++++++++++-------
> 1 file changed, 13 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/net/usb/asix_devices.c b/drivers/net/usb/asix_devices.c
> index f7cff58fe044..11417ed86d9e 100644
> --- a/drivers/net/usb/asix_devices.c
> +++ b/drivers/net/usb/asix_devices.c
> @@ -230,7 +230,9 @@ static int ax88172_bind(struct usbnet *dev, struct usb_interface *intf)
> int i;
> unsigned long gpio_bits = dev->driver_info->data;
>
> - usbnet_get_endpoints(dev,intf);
> + ret = usbnet_get_endpoints(dev, intf);
> + if (ret)
> + goto out;
>
> /* Toggle the GPIOs in a manufacturer/model specific way */
> for (i = 2; i >= 0; i--) {
> @@ -834,7 +836,9 @@ static int ax88772_bind(struct usbnet *dev, struct usb_interface *intf)
>
> dev->driver_priv = priv;
>
> - usbnet_get_endpoints(dev, intf);
> + ret = usbnet_get_endpoints(dev, intf);
> + if (ret)
> + goto mdio_err;
>
> /* Maybe the boot loader passed the MAC address via device tree */
> if (!eth_platform_get_mac_address(&dev->udev->dev, buf)) {
> @@ -858,7 +862,7 @@ static int ax88772_bind(struct usbnet *dev, struct usb_interface *intf)
> if (ret < 0) {
> netdev_dbg(dev->net, "Failed to read MAC address: %d\n",
> ret);
> - return ret;
> + goto mdio_err;
> }
> }
>
The two hunks above do not seem related to the subject of the patch, but
rather separate cleanups. So I think they should not be part of this patch.
Instead they could be a separate patch, targeted at net-next. (FWIIW, I
would go the other way and drop the mdio_err label from this function.)
> @@ -871,7 +875,7 @@ static int ax88772_bind(struct usbnet *dev, struct usb_interface *intf)
>
> ret = asix_read_phy_addr(dev, true);
> if (ret < 0)
> - return ret;
> + goto mdio_err;
>
> priv->phy_addr = ret;
> priv->embd_phy = ((priv->phy_addr & 0x1f) == AX_EMBD_PHY_ADDR);
> @@ -880,7 +884,7 @@ static int ax88772_bind(struct usbnet *dev, struct usb_interface *intf)
> &priv->chipcode, 0);
> if (ret < 0) {
> netdev_dbg(dev->net, "Failed to read STATMNGSTS_REG: %d\n", ret);
> - return ret;
> + goto mdio_err;
> }
>
> priv->chipcode &= AX_CHIPCODE_MASK;
> @@ -895,7 +899,7 @@ static int ax88772_bind(struct usbnet *dev, struct usb_interface *intf)
> ret = priv->reset(dev, 0);
> if (ret < 0) {
> netdev_dbg(dev->net, "Failed to reset AX88772: %d\n", ret);
> - return ret;
> + goto mdio_err;
> }
>
> /* Asix framing packs multiple eth frames into a 2K usb bulk transfer */
> @@ -1258,7 +1262,9 @@ static int ax88178_bind(struct usbnet *dev, struct usb_interface *intf)
> int ret;
> u8 buf[ETH_ALEN] = {0};
>
> - usbnet_get_endpoints(dev,intf);
> + ret = usbnet_get_endpoints(dev, intf);
> + if (ret)
> + return ret;
>
> /* Get the MAC address */
> ret = asix_read_cmd(dev, AX_CMD_READ_NODE_ID, 0, 0, ETH_ALEN, buf, 0);
> --
> 2.25.1
>
>
next prev parent reply other threads:[~2024-04-03 10:53 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-02 11:30 [PATCH -next] net: usb: asix: Add check for usbnet_get_endpoints Yi Yang
2024-04-03 10:53 ` Simon Horman [this message]
2024-04-07 2:11 ` yiyang (D)
2024-04-04 10:09 ` Paolo Abeni
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=20240403105329.GV26556@kernel.org \
--to=horms@kernel.org \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=wangweiyang2@huawei.com \
--cc=yiyang13@huawei.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.