All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Vladimir Oltean" <vladimir.oltean@nxp.com>
Cc: imx@lists.linux.dev, Frank.Li@kernel.org
Subject: Re: [PATCH v9 3/3] usb: gadget: tegra-xudc: avoid direct dereference of phy->dev.of_node
Date: Mon, 10 Aug 2026 13:07:27 +0000	[thread overview]
Message-ID: <20260810130727.D1AB51F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260810125614.441667-4-vladimir.oltean@nxp.com>

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] Missing error code assignment when `of_property_match_string()` fails, causing a silent initialization failure.
- [Low] Malformed error message format string splits log across two lines.
--

--- Patch [3]: [PATCH v9 3/3] usb: gadget: tegra-xudc: avoid direct dereference of phy->dev.of_node ---
commit 5dbf80ca5d539781ed1dcc83abb9ad4e29628462
Author: Vladimir Oltean <vladimir.oltean@nxp.com>

usb: gadget: tegra-xudc: avoid direct dereference of phy->dev.of_node

This patch reworks the PHY lookup in the Tegra XUDC driver to avoid directly
dereferencing phy->dev.of_node. It introduces a parallel OF node lookup path
based on the "phys" phandle and the #phy-cells of the padctl provider.

> diff --git a/drivers/usb/gadget/udc/tegra-xudc.c b/drivers/usb/gadget/udc/tegra-xudc.c
> --- a/drivers/usb/gadget/udc/tegra-xudc.c
> +++ b/drivers/usb/gadget/udc/tegra-xudc.c
[ ... ]
> @@ -3525,22 +3529,39 @@ static int tegra_xudc_phy_get(struct tegra_xudc *xudc)
[ ... ]
>  		} else if (!xudc->utmi_phy[i]) {
>  			/* if utmi phy is not available, ignore USB3 phy get */
>  			continue;
>  		}
>  
> +		index = of_property_match_string(np, "phy-names", phy_name);
> +		if (index < 0) {
> +			dev_err(xudc->dev,
> +				"no \"phy-names\" entry for \"%s\": %pe\n",
> +				phy_name, ERR_PTR(index));
> +			goto clean_up;
> +		}

[Severity: High]
If this fails, we jump to clean_up without updating the err variable. Since err
was initialized to 0, would this cause the driver probe to falsely report
success without having acquired the PHYs?

Could we assign err = index before the goto?

> +
> +		err = of_parse_phandle_with_args(np, "phys", "#phy-cells",
> +						 index, &args);
> +		if (err) {
> +			dev_err(xudc->dev,
> +				"failed to follow \"%s\" reference\n: %pe\n",
> +				phy_name, ERR_PTR(err));

[Severity: Low]
This isn't a bug, but there is an extraneous newline before the colon in the
format string which will split the log message across two lines.

> +			goto clean_up;
> +		}

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260810125614.441667-1-vladimir.oltean@nxp.com?part=3

      reply	other threads:[~2026-08-10 13:07 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-10 12:56 [PATCH v9 0/3] USB prerequisites for PHY consumer/provider split Vladimir Oltean
2026-08-10 12:56 ` [PATCH v9 1/3] usb: add missing headers transitively included by <linux/phy/phy.h> Vladimir Oltean
2026-08-10 17:05   ` Frank Li
2026-08-10 12:56 ` [PATCH v9 2/3] usb: host: tegra: avoid direct dereference of phy->dev.of_node Vladimir Oltean
2026-08-10 13:08   ` sashiko-bot
2026-08-10 12:56 ` [PATCH v9 3/3] usb: gadget: tegra-xudc: " Vladimir Oltean
2026-08-10 13:07   ` sashiko-bot [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=20260810130727.D1AB51F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=Frank.Li@kernel.org \
    --cc=imx@lists.linux.dev \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=vladimir.oltean@nxp.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.