linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Al Cooper <alcooperx@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: Al Cooper <alcooperx@gmail.com>,
	devicetree@vger.kernel.org, Felipe Balbi <balbi@kernel.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-usb@vger.kernel.org, Luis Chamberlain <mcgrof@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Rob Herring <robh+dt@kernel.org>
Subject: [PATCH 2/6] usb: bdc: Cleanup clock support
Date: Thu, 20 Jun 2019 17:09:47 -0400	[thread overview]
Message-ID: <1561064991-16874-3-git-send-email-alcooperx@gmail.com> (raw)
In-Reply-To: <1561064991-16874-1-git-send-email-alcooperx@gmail.com>

- Fix driver to defer on clk_get defer

Signed-off-by: Al Cooper <alcooperx@gmail.com>
---
 drivers/usb/gadget/udc/bdc/bdc_core.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/drivers/usb/gadget/udc/bdc/bdc_core.c b/drivers/usb/gadget/udc/bdc/bdc_core.c
index ccbd1d34eb2a..11a43de6c1c6 100644
--- a/drivers/usb/gadget/udc/bdc/bdc_core.c
+++ b/drivers/usb/gadget/udc/bdc/bdc_core.c
@@ -490,8 +490,14 @@ static int bdc_probe(struct platform_device *pdev)
 
 	dev_dbg(dev, "%s()\n", __func__);
 
+	bdc = devm_kzalloc(dev, sizeof(*bdc), GFP_KERNEL);
+	if (!bdc)
+		return -ENOMEM;
+
 	clk = devm_clk_get(dev, "sw_usbd");
 	if (IS_ERR(clk)) {
+		if (PTR_ERR(clk) == -EPROBE_DEFER)
+			return -EPROBE_DEFER;
 		dev_info(dev, "Clock not found in Device Tree\n");
 		clk = NULL;
 	}
@@ -501,11 +507,6 @@ static int bdc_probe(struct platform_device *pdev)
 		dev_err(dev, "could not enable clock\n");
 		return ret;
 	}
-
-	bdc = devm_kzalloc(dev, sizeof(*bdc), GFP_KERNEL);
-	if (!bdc)
-		return -ENOMEM;
-
 	bdc->clk = clk;
 
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
@@ -551,7 +552,7 @@ static int bdc_probe(struct platform_device *pdev)
 	ret = bdc_phy_init(bdc);
 	if (ret) {
 		dev_err(bdc->dev, "BDC phy init failure:%d\n", ret);
-		return ret;
+		goto clk_cleanup;
 	}
 
 	temp = bdc_readl(bdc->regs, BDC_BDCCAP1);
@@ -583,6 +584,8 @@ static int bdc_probe(struct platform_device *pdev)
 	bdc_hw_exit(bdc);
 phycleanup:
 	bdc_phy_exit(bdc);
+clk_cleanup:
+	clk_disable_unprepare(bdc->clk);
 	return ret;
 }
 
-- 
1.9.0.138.g2de3478


  parent reply	other threads:[~2019-06-20 21:10 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-20 21:09 [PATCH 0/6] usb: bdc: Updates and fixes to USB BDC driver Al Cooper
2019-06-20 21:09 ` [PATCH 1/6] usb: bdc: driver runs out of buffer descriptors on large ADB transfers Al Cooper
2019-06-20 21:09 ` Al Cooper [this message]
2019-06-21  5:26   ` [PATCH 2/6] usb: bdc: Cleanup clock support Chunfeng Yun
2019-06-21 13:44     ` Alan Cooper
2019-06-20 21:09 ` [PATCH 3/6] usb: bdc: driver may fail to get USB PHY Al Cooper
2019-06-21  5:39   ` Chunfeng Yun
2019-06-21 13:39     ` Alan Cooper
2019-06-20 21:09 ` [PATCH 4/6] usb: bdc: Fix bug causing crash after multiple disconnects Al Cooper
2019-06-20 21:09 ` [PATCH 5/6] dt-bindings: usb: bdc: Update compatible strings Al Cooper
2019-07-09 20:14   ` Rob Herring
2019-06-20 21:09 ` [PATCH 6/6] usb: bdc: Update compatible match strings Al Cooper
2019-06-21  8:28   ` Sergei Shtylyov
2019-06-21 13:47     ` Alan Cooper

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=1561064991-16874-3-git-send-email-alcooperx@gmail.com \
    --to=alcooperx@gmail.com \
    --cc=balbi@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mcgrof@kernel.org \
    --cc=robh+dt@kernel.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;
as well as URLs for NNTP newsgroup(s).