public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Théo Lebrun" <theo.lebrun@bootlin.com>
To: "Abhash Kumar Jha" <a-kumar2@ti.com>,
	<gregkh@linuxfoundation.org>, <pawell@cadence.com>,
	<peter.chen@kernel.org>
Cc: <linux-arm-kernel@lists.infradead.org>,
	<linux-kernel@vger.kernel.org>, <linux-usb@vger.kernel.org>,
	<rogerq@kernel.org>, <u-kumar1@ti.com>, <p-mantena@ti.com>,
	<theo.lebrun@bootlin.com>
Subject: Re: [PATCH] usb: cdns3: host: Add null check for host_device before accessing its members
Date: Mon, 19 Jan 2026 12:08:40 +0100	[thread overview]
Message-ID: <DFSIOP130201.PFP7SFMSZYFA@bootlin.com> (raw)
In-Reply-To: <20260119082242.1922599-1-a-kumar2@ti.com>

Hello Abhash,

On Mon Jan 19, 2026 at 9:22 AM CET, Abhash Kumar Jha wrote:
> In cases when the xhci device is not populated, we see a nullptr
> exception when resuming.
>
> Add a nullptr check for the host_dev before accessing its private data.
>
> Fixes: 3a85c1011540 ("usb: host: cdns3: forward lost power information to xhci")
> Signed-off-by: Abhash Kumar Jha <a-kumar2@ti.com>
> ---
>  drivers/usb/cdns3/host.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/usb/cdns3/host.c b/drivers/usb/cdns3/host.c
> index f0df114c2b53b..8cc7fc1de6193 100644
> --- a/drivers/usb/cdns3/host.c
> +++ b/drivers/usb/cdns3/host.c
> @@ -141,9 +141,12 @@ static void cdns_host_exit(struct cdns *cdns)
>  static int cdns_host_resume(struct cdns *cdns, bool power_lost)
>  {
>  	struct usb_hcd *hcd = platform_get_drvdata(cdns->host_dev);
> -	struct xhci_plat_priv *priv = hcd_to_xhci_priv(hcd);
> +	struct xhci_plat_priv *priv;
>  
> -	priv->power_lost = power_lost;
> +	if (hcd) {
> +		priv = hcd_to_xhci_priv(hcd);
> +		priv->power_lost = power_lost;
> +	}

I am not seeing a codepath making it possible for drvdata to be NULL.
Can you point it out? What HW, what config, etc.

Thanks,

--
Théo Lebrun, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com


  parent reply	other threads:[~2026-01-19 11:08 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-19  8:22 [PATCH] usb: cdns3: host: Add null check for host_device before accessing its members Abhash Kumar Jha
2026-01-19  9:33 ` Greg KH
2026-01-19 11:08 ` Théo Lebrun [this message]
2026-01-29 14:34 ` Thomas Richard

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=DFSIOP130201.PFP7SFMSZYFA@bootlin.com \
    --to=theo.lebrun@bootlin.com \
    --cc=a-kumar2@ti.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=p-mantena@ti.com \
    --cc=pawell@cadence.com \
    --cc=peter.chen@kernel.org \
    --cc=rogerq@kernel.org \
    --cc=u-kumar1@ti.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