From: linux@arm.linux.org.uk (Russell King - ARM Linux)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/2] chipidea: ci_hdrc_imx: Allow handling the clock for an USB phy/hub
Date: Thu, 14 Nov 2013 09:56:58 +0000 [thread overview]
Message-ID: <20131114095658.GY16735@n2100.arm.linux.org.uk> (raw)
In-Reply-To: <1384394987-15134-1-git-send-email-festevam@gmail.com>
On Thu, Nov 14, 2013 at 12:09:46AM -0200, Fabio Estevam wrote:
> @@ -107,10 +108,22 @@ static int ci_hdrc_imx_probe(struct platform_device *pdev)
> return ret;
> }
>
> + data->clk_phy = devm_clk_get(&pdev->dev, "phy");
> + if (IS_ERR(data->clk_phy)) {
> + data->clk_phy = NULL;
> + } else {
Please stop using NULL as a indicator with functions which only return
failure as an error pointer. Replace the above three lines with
if (!IS_ERR(data->clk_phy)) {
> + ret = clk_prepare_enable(data->clk_phy);
> + if (ret) {
> + dev_err(&pdev->dev,
> + "Failed to enable clk_phy: %d\n", ret);
> + goto err_clk;
> + }
> + }
> +
> data->phy = devm_usb_get_phy_by_phandle(&pdev->dev, "fsl,usbphy", 0);
> if (IS_ERR(data->phy)) {
> ret = PTR_ERR(data->phy);
> - goto err_clk;
> + goto err_clk_phy;
> }
>
> pdata.phy = data->phy;
> @@ -157,6 +170,9 @@ static int ci_hdrc_imx_probe(struct platform_device *pdev)
>
> disable_device:
> ci_hdrc_remove_device(data->ci_pdev);
> +err_clk_phy:
> + if (data->clk_phy)
This test should not be necessary if you've nested the error cleanup.
> + clk_disable_unprepare(data->clk_phy);
> err_clk:
> clk_disable_unprepare(data->clk);
> return ret;
> @@ -168,6 +184,8 @@ static int ci_hdrc_imx_remove(struct platform_device *pdev)
>
> pm_runtime_disable(&pdev->dev);
> ci_hdrc_remove_device(data->ci_pdev);
> + if (data->clk_phy)
if (!IS_ERR(data->clk_phy))
> + clk_disable_unprepare(data->clk_phy);
> clk_disable_unprepare(data->clk);
>
> return 0;
> --
> 1.8.1.2
>
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2013-11-14 9:56 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-14 2:09 [PATCH 1/2] chipidea: ci_hdrc_imx: Allow handling the clock for an USB phy/hub Fabio Estevam
2013-11-14 2:09 ` [PATCH 2/2] ARM: dts: imx6q-udoo: Add USB host support Fabio Estevam
2013-12-02 11:53 ` Mark Rutland
2013-12-03 7:17 ` Shawn Guo
2013-11-14 3:24 ` [PATCH 1/2] chipidea: ci_hdrc_imx: Allow handling the clock for an USB phy/hub Shawn Guo
2013-11-14 9:56 ` Russell King - ARM Linux [this message]
2013-11-14 10:48 ` Fabio Estevam
2013-12-02 11:51 ` Mark Rutland
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=20131114095658.GY16735@n2100.arm.linux.org.uk \
--to=linux@arm.linux.org.uk \
--cc=linux-arm-kernel@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;
as well as URLs for NNTP newsgroup(s).