From patchwork Thu Jun 20 21:09:47 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alan Cooper X-Patchwork-Id: 11008169 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id F218E14DB for ; Thu, 20 Jun 2019 21:10:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E4C6628458 for ; Thu, 20 Jun 2019 21:10:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D92502847B; Thu, 20 Jun 2019 21:10:46 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 83A3F281C3 for ; Thu, 20 Jun 2019 21:10:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726134AbfFTVKl (ORCPT ); Thu, 20 Jun 2019 17:10:41 -0400 Received: from mail-pg1-f194.google.com ([209.85.215.194]:43954 "EHLO mail-pg1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726716AbfFTVKM (ORCPT ); Thu, 20 Jun 2019 17:10:12 -0400 Received: by mail-pg1-f194.google.com with SMTP id f25so2202842pgv.10; Thu, 20 Jun 2019 14:10:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=G1Ij2gv2TDQKvgmKxxszCgpp7AI+3jM9fqq69fwOpA4=; b=S0b2a7aE0WAuieFytAiXyQlQYVr7CGECSzLS6wJFSzGtJ+1HgTIIaRECxzTfKTjNkb cErfqueoa45U43t+jz8QO0Zwp/ZwWHSElXz3DG5jBope2nWbrkpDBhA9V5YnPEj/MbyN B67GD9QJ35CfNL5Exh83tpWY1m75RLYEzuyFH3wTESQ1cFH2WuascjO24sU7gvKKUC5X 0sm+/gYt6xFT3mUBqYxXFtiqMEuW6YfUZaLiLbHkf5Awrc2EcrPeowK9YqkPooHME/mE oVNqgxxj3NpqdCZ89eLk5V608mQw2kea8NJ9K65x4x3D6Gebm6f9uhgvtou/id7uGQqH 2aYg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=G1Ij2gv2TDQKvgmKxxszCgpp7AI+3jM9fqq69fwOpA4=; b=QeWulPQmbgmfywwsgPA9AYqLrmzKW9i8f08hEeS0pbKdFAglAnNODCLdueyH+eDcFu clU6pzPBgcmRRjDM/wTHclcJuMD1g8WSuOLxZ+docL/WGwl7zRBD7Z9NyequoTQ2ZoLY K8PlV3bcOWi1gMppjP6lm9K8XQgVC00v+eu9/4pg1sEAbj8koXahsdNPGAuubSET7o5T JFkfVyaNTotfV3SY+oeS3dIaQDyKYcfG8vSw+kN4vHOEgXYkKTdXjA3nb/2or7I85J3Q gAVo9JNoqwpwRaqcPJubjPTclIeRkLJpBdhYPrvQrMYhN/VYyPkj36frQcTzyOcE5kR1 msyw== X-Gm-Message-State: APjAAAXl1cM84Mxijtmx9OOud9U4WdqPig1cgedz9PEMzBV/Dp94dfWP yZQ8VirK9aRPaObprO8/r0glDgx06rc= X-Google-Smtp-Source: APXvYqzhfbSmcHI0Ef9C7wLbXuSiZnL4lXcN/K/RVjRqcfrVNFxMmQJbBdZzfxS1WWdDw4WarFSUVw== X-Received: by 2002:a17:90a:a505:: with SMTP id a5mr1715567pjq.27.1561065011551; Thu, 20 Jun 2019 14:10:11 -0700 (PDT) Received: from stbsrv-and-3.and.broadcom.com ([192.19.231.250]) by smtp.gmail.com with ESMTPSA id p1sm386805pff.74.2019.06.20.14.10.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 20 Jun 2019 14:10:11 -0700 (PDT) From: Al Cooper To: linux-kernel@vger.kernel.org Cc: Al Cooper , devicetree@vger.kernel.org, Felipe Balbi , Greg Kroah-Hartman , linux-usb@vger.kernel.org, Luis Chamberlain , Mark Rutland , Rob Herring Subject: [PATCH 2/6] usb: bdc: Cleanup clock support Date: Thu, 20 Jun 2019 17:09:47 -0400 Message-Id: <1561064991-16874-3-git-send-email-alcooperx@gmail.com> X-Mailer: git-send-email 1.9.0.138.g2de3478 In-Reply-To: <1561064991-16874-1-git-send-email-alcooperx@gmail.com> References: <1561064991-16874-1-git-send-email-alcooperx@gmail.com> Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP - Fix driver to defer on clk_get defer Signed-off-by: Al Cooper --- 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; }