mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Jules Maselbas <jmaselbas@kalray.eu>
To: barebox@lists.infradead.org
Cc: Jules Maselbas <jmaselbas@kalray.eu>
Subject: [PATCH] phy: usb-nop-xceiv: Make the clock always optional
Date: Wed,  9 Dec 2020 14:14:54 +0100	[thread overview]
Message-ID: <20201209131454.5248-1-jmaselbas@kalray.eu> (raw)

The clock seems to be optional at probe time, if not found it's set
to NULL. However this was not the case in the function nop_usbphy_init
which exits with error if the clock cannot be enabled.

Make the clock optional also during the nop_usbphy_init by trying to
do the clock init only if the clock has been found during probe.

Signed-off-by: Jules Maselbas <jmaselbas@kalray.eu>
---
 drivers/phy/usb-nop-xceiv.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/phy/usb-nop-xceiv.c b/drivers/phy/usb-nop-xceiv.c
index 7ea7d28a2..b549b564b 100644
--- a/drivers/phy/usb-nop-xceiv.c
+++ b/drivers/phy/usb-nop-xceiv.c
@@ -46,9 +46,11 @@ static int nop_usbphy_init(struct phy *phy)
 	int ret;
 	struct nop_usbphy *nopphy = phy_get_drvdata(phy);
 
-	ret = clk_enable(nopphy->clk);
-	if (ret < 0)
-		return ret;
+	if (nopphy->clk) {
+		ret = clk_enable(nopphy->clk);
+		if (ret < 0)
+			return ret;
+	}
 
 	if (gpio_is_valid(nopphy->reset)) {
 		/*
-- 
2.17.1



_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

             reply	other threads:[~2020-12-09 13:15 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-09 13:14 Jules Maselbas [this message]
2020-12-10  9:04 ` Sascha Hauer
2020-12-10  9:40   ` Jules Maselbas

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=20201209131454.5248-1-jmaselbas@kalray.eu \
    --to=jmaselbas@kalray.eu \
    --cc=barebox@lists.infradead.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox