linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: kishon@ti.com (Kishon Vijay Abraham I)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/8] phy: rockchip-usb: fix clock get-put mismatch
Date: Fri, 13 Nov 2015 11:58:51 +0530	[thread overview]
Message-ID: <56458323.6040506@ti.com> (raw)
In-Reply-To: <1446673454-9529-2-git-send-email-heiko@sntech.de>

Hi,

On Thursday 05 November 2015 03:14 AM, Heiko Stuebner wrote:
> Currently the phy driver only gets the optional clock reference but
> never puts it again, neither during error handling nor on remove.
> Fix that by moving the clk_put to a devm-action that gets called at
> the right time when all other devm actions are done.
> 
> Signed-off-by: Heiko Stuebner <heiko@sntech.de>
> ---
>  drivers/phy/phy-rockchip-usb.c | 15 +++++++++++++++
>  1 file changed, 15 insertions(+)
> 
> diff --git a/drivers/phy/phy-rockchip-usb.c b/drivers/phy/phy-rockchip-usb.c
> index 91d6f34..dfc056b 100644
> --- a/drivers/phy/phy-rockchip-usb.c
> +++ b/drivers/phy/phy-rockchip-usb.c
> @@ -90,6 +90,14 @@ static const struct phy_ops ops = {
>  	.owner		= THIS_MODULE,
>  };
>  
> +static void rockchip_usb_phy_action(void *data)
> +{
> +	struct rockchip_usb_phy *rk_phy = data;
> +
> +	if (rk_phy->clk)
> +		clk_put(rk_phy->clk);
> +}
> +
>  static int rockchip_usb_phy_probe(struct platform_device *pdev)
>  {
>  	struct device *dev = &pdev->dev;
> @@ -124,6 +132,13 @@ static int rockchip_usb_phy_probe(struct platform_device *pdev)
>  		if (IS_ERR(rk_phy->clk))
>  			rk_phy->clk = NULL;
>  
> +		err = devm_add_action(dev, rockchip_usb_phy_action, rk_phy);
> +		if (err) {
> +			if (rk_phy->clk)
> +				clk_put(rk_phy->clk);

If devm_add_action is added before clk_get this check wouldn't be required at all.

Thanks
Kishon

  parent reply	other threads:[~2015-11-13  6:28 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-04 21:44 [PATCH 0/8] phy: rockchip-usb: correct pll handling and usb-uart Heiko Stuebner
2015-11-04 21:44 ` [PATCH 1/8] phy: rockchip-usb: fix clock get-put mismatch Heiko Stuebner
2015-11-04 23:34   ` Doug Anderson
2015-11-13  6:28   ` Kishon Vijay Abraham I [this message]
2015-11-04 21:44 ` [PATCH 2/8] phy: rockchip-usb: introduce a common data-struct for the device Heiko Stuebner
2015-11-04 23:46   ` Doug Anderson
2015-11-04 23:55     ` Heiko Stuebner
2015-11-04 21:44 ` [PATCH 3/8] phy: rockchip-usb: move per-phy init into a separate function Heiko Stuebner
2015-11-04 23:53   ` Doug Anderson
2015-11-04 21:44 ` [PATCH 4/8] phy: rockchip-usb: expose the phy-internal PLLs Heiko Stuebner
2015-11-13  8:48   ` Kishon Vijay Abraham I
2015-11-04 21:44 ` [PATCH 5/8] clk: rockchip: fix usbphy-related clocks Heiko Stuebner
2015-12-05  0:07   ` Michael Turquette
2015-12-05 10:12     ` Heiko Stübner
2015-11-04 21:44 ` [PATCH 6/8] ARM: dts: rockchip: add clock-cells for usb phy nodes Heiko Stuebner
2015-12-05  0:07   ` Michael Turquette
2015-11-04 21:44 ` [PATCH 7/8] ARM: dts: rockchip: assign usbphy480m_src to the new usbphy pll on veyron Heiko Stuebner
2015-11-04 21:44 ` [PATCH 8/8] phy: rockchip-usb: add handler for usb-uart functionality Heiko Stuebner

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=56458323.6040506@ti.com \
    --to=kishon@ti.com \
    --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).