All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefan Eichenberger <eichest@gmail.com>
To: Marek Vasut <marek.vasut@mailbox.org>
Cc: marek.vasut+usb@mailbox.org, trini@konsulko.com,
	mkorpershoek@kernel.org, stefan.eichenberger@toradex.com,
	hayashi.kunihiko@socionext.com, Tom.Hsieh@advantech.com,
	u-boot@lists.u-boot-project.org
Subject: Re: [PATCH v2] usb: dwc3-generic: fix ref clock lookup indexing wrong clk_bulk array
Date: Thu, 24 Sep 2026 14:51:45 +0200	[thread overview]
Message-ID: <arUc4cNrKbx71ms7@eichest-laptop> (raw)
In-Reply-To: <65e822e4-5edd-4d48-8bdd-f7a614925a73@mailbox.org>

Hi Marek,

On Wed, Sep 23, 2026 at 03:30:44PM +0200, Marek Vasut wrote:
> On 9/22/26 10:42 PM, Stefan Eichenberger wrote:
> 
> Hello Stefan,
> 
> > +	rc = clk_get_by_name(dev, "ref", &clk);
> > +	if (rc)
> > +		rc = clk_get_by_name(dev, "ref_clk", &clk);
> > +	/*
> > +	 * Only fall back to the parent node's clocks if the parent is a
> > +	 * dwc3 glue wrapper. When the generic node is a top level node,
> > +	 * the parent is not the glue device but a bus or the root device,
> > +	 * and its clocks are unrelated to the controller.
> > +	 */
> > +	if (rc && dev->parent && strstr(dev->parent->driver->name, "dwc3")) {
> 
> Could dev->parent->driver be NULL ?
> 

It should never be NULL. This could only happen when we define it in the
root node but then it should never bind. However, I guess it's better to
be safe and check for NULL anyways in case something is really wrong. I
will add the check in the next version.

> > +		rc = clk_get_by_name(dev->parent, "ref", &clk);
> > +		if (rc)
> > +			rc = clk_get_by_name(dev->parent, "ref_clk", &clk);
> > +	}
> > +	if (!rc) {
> > +		priv->ref_clk = clk;
> > +
> > +		rc = clk_enable(&priv->ref_clk);
> > +		if (rc && rc != -ENOSYS)
> > +			dev_warn(dev, "failed to enable ref clock: %d\n", rc);
> 
> Shouldn't the driver fail to probe if clock cannot be enabled ?

Yes that makes sense, I will change that in the next version.

Regards,
Stefan

  reply	other threads:[~2026-09-24 13:01 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-22 20:42 [PATCH v2] usb: dwc3-generic: fix ref clock lookup indexing wrong clk_bulk array Stefan Eichenberger
2026-09-23 13:30 ` Marek Vasut
2026-09-24 12:51   ` Stefan Eichenberger [this message]
2026-09-24 13:34     ` Marek Vasut

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=arUc4cNrKbx71ms7@eichest-laptop \
    --to=eichest@gmail.com \
    --cc=Tom.Hsieh@advantech.com \
    --cc=hayashi.kunihiko@socionext.com \
    --cc=marek.vasut+usb@mailbox.org \
    --cc=marek.vasut@mailbox.org \
    --cc=mkorpershoek@kernel.org \
    --cc=stefan.eichenberger@toradex.com \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.u-boot-project.org \
    /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.