From patchwork Mon May 28 14:36:13 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roger Quadros X-Patchwork-Id: 10433043 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 996EF60327 for ; Mon, 28 May 2018 14:36:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 89338289FD for ; Mon, 28 May 2018 14:36:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7DAA028A0D; Mon, 28 May 2018 14:36:48 +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=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID 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 01819289FD for ; Mon, 28 May 2018 14:36:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1161519AbeE1Ogq (ORCPT ); Mon, 28 May 2018 10:36:46 -0400 Received: from lelnx194.ext.ti.com ([198.47.27.80]:56455 "EHLO lelnx194.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S968913AbeE1Og0 (ORCPT ); Mon, 28 May 2018 10:36:26 -0400 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by lelnx194.ext.ti.com (8.15.1/8.15.1) with ESMTP id w4SEaMId005754; Mon, 28 May 2018 09:36:22 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1527518182; bh=Nk36gBcPW7+w2f37YmMfcmlWKIduTT3ABykOtbltv3E=; h=From:To:CC:Subject:Date; b=Z/JTTpaIjOLysdYGmXJekOT5RpTqkO0712h2iDuSnWdv7rdbp3W7Oae93FXFimhHs P0CGPJySnzpqJlf1YRH3zUw1EhI+HIwbJA81UR83lJceJ416JSO4J7upaUfpKrTuJW hnsqbnO94qVGcw5nm32y7e95mC9h+cqdBHE2bOik= Received: from DLEE114.ent.ti.com (dlee114.ent.ti.com [157.170.170.25]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id w4SEaMUV021741; Mon, 28 May 2018 09:36:22 -0500 Received: from DLEE104.ent.ti.com (157.170.170.34) by DLEE114.ent.ti.com (157.170.170.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1466.3; Mon, 28 May 2018 09:36:22 -0500 Received: from dlep32.itg.ti.com (157.170.170.100) by DLEE104.ent.ti.com (157.170.170.34) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1466.3 via Frontend Transport; Mon, 28 May 2018 09:36:22 -0500 Received: from dlelxv97.itg.ti.com (dlelxv97.itg.ti.com [172.17.2.193]) by dlep32.itg.ti.com (8.14.3/8.13.8) with ESMTP id w4SEaMVG017207; Mon, 28 May 2018 09:36:22 -0500 Received: from lta0400828d.ti.com (vboxa0400828d.emea.dhcp.ti.com [172.22.236.98]) by dlelxv97.itg.ti.com (8.14.3/8.13.8) with ESMTP id w4SEaKPK014400; Mon, 28 May 2018 09:36:21 -0500 From: Roger Quadros To: CC: , , Roger Quadros Subject: [PATCH 1/2] usb: dwc3: of-simple: Don't fail if no clock entries Date: Mon, 28 May 2018 17:36:13 +0300 Message-ID: <1527518174-27860-1-git-send-email-rogerq@ti.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 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 of_count_phandle_with_args() returns -ENOENT (-2) if there are no clock entries. Don't fail in such a case. Signed-off-by: Roger Quadros --- drivers/usb/dwc3/dwc3-of-simple.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/usb/dwc3/dwc3-of-simple.c b/drivers/usb/dwc3/dwc3-of-simple.c index cb2ee96..e98d221 100644 --- a/drivers/usb/dwc3/dwc3-of-simple.c +++ b/drivers/usb/dwc3/dwc3-of-simple.c @@ -36,11 +36,11 @@ static int dwc3_of_simple_clk_init(struct dwc3_of_simple *simple, int count) struct device_node *np = dev->of_node; int i; - simple->num_clocks = count; - - if (!count) + if (count <= 0) return 0; + simple->num_clocks = count; + simple->clks = devm_kcalloc(dev, simple->num_clocks, sizeof(struct clk *), GFP_KERNEL); if (!simple->clks)