lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20140912202942.GC25500@saruman.home>
Date:	Fri, 12 Sep 2014 15:29:43 -0500
From:	Felipe Balbi <balbi@...com>
To:	Pramod Gurav <pramod.gurav@...rtplayin.com>
CC:	<balbi@...com>, Pramod Gurav <pramod.gurav.etc@...il.com>,
	Andy Gross <agross@...eaurora.org>,
	"devicetree@...r.kernel.org" <devicetree@...r.kernel.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	"linux-arm-kernel@...ts.infradead.org" 
	<linux-arm-kernel@...ts.infradead.org>,
	Kishon Vijay Abraham I <kishon@...com>,
	Jack Pham <jackp@...eaurora.org>,
	Kumar Gala <galak@...eaurora.org>,
	linux-arm-msm <linux-arm-msm@...r.kernel.org>,
	<linux-usb@...r.kernel.org>, "Ivan T. Ivanov" <iivanov@...sol.com>,
	Bjorn Andersson <bjorn.andersson@...ymobile.com>
Subject: Re: [Patch v9 2/3] usb: dwc3: Add Qualcomm DWC3 glue layer driver

Hi,

On Sat, Sep 13, 2014 at 01:55:50AM +0530, Pramod Gurav wrote:
> >>> +       qdwc = devm_kzalloc(&pdev->dev, sizeof(*qdwc), GFP_KERNEL);
> >>> +       if (!qdwc)
> >>> +               return -ENOMEM;
> >>> +
> >>> +       platform_set_drvdata(pdev, qdwc);
> >>> +
> >>> +       qdwc->dev = &pdev->dev;
> >>> +
> >>> +       qdwc->core_clk = devm_clk_get(qdwc->dev, "core");
> >>> +       if (IS_ERR(qdwc->core_clk)) {
> >>> +               dev_err(qdwc->dev, "failed to get core clock\n");
> >>> +               return PTR_ERR(qdwc->core_clk);
> >>> +       }
> >>> +
> >>> +       qdwc->iface_clk = devm_clk_get(qdwc->dev, "iface");
> >>> +       if (IS_ERR(qdwc->iface_clk)) {
> >>> +               dev_dbg(qdwc->dev, "failed to get optional iface clock\n");
> >>> +               qdwc->iface_clk = NULL;
> >>> +       }
> >>> +
> >>> +       qdwc->sleep_clk = devm_clk_get(qdwc->dev, "sleep");
> >>> +       if (IS_ERR(qdwc->sleep_clk)) {
> >>> +               dev_dbg(qdwc->dev, "failed to get optional sleep clock\n");
> >>> +               qdwc->sleep_clk = NULL;
> >>> +       }
> >>> +
> >>> +       ret = clk_prepare_enable(qdwc->core_clk);
> >>> +       if (ret) {
> >>> +               dev_err(qdwc->dev, "failed to enable core clock\n");
> >>> +               goto err_core;
> >>> +       }
> >>> +
> >>> +       ret = clk_prepare_enable(qdwc->iface_clk);
> >>>
> >> Should not we check if  qdwc->iface_clk is valid?
> > 
> > read the sources luke.
> Now I read that its initialized to NULL in fail case but should we call
> prepare_enable at all if its NULL?

now read the source of clk_enable() and clk_prepare() ;-) NULL is a
valid clock, it just returns 0. This is better than sprinkling IS_ERR()
all over the place.

-- 
balbi

Download attachment "signature.asc" of type "application/pgp-signature" (820 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ