Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752461AbcDTMzX (ORCPT ); Wed, 20 Apr 2016 08:55:23 -0400 Received: from mga02.intel.com ([134.134.136.20]:39831 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752221AbcDTMzS (ORCPT ); Wed, 20 Apr 2016 08:55:18 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.24,509,1455004800"; d="scan'208";a="88622027" Subject: Re: [PATCH 2/4] i2c: designware-platdrv: fix unbalanced clk enable and prepare To: Jisheng Zhang , andriy.shevchenko@linux.intel.com, mika.westerberg@linux.intel.com, wsa@the-dreams.de References: <1460638414-5987-1-git-send-email-jszhang@marvell.com> <1460638414-5987-3-git-send-email-jszhang@marvell.com> Cc: linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org From: Jarkko Nikula Message-ID: <57177C32.4090000@linux.intel.com> Date: Wed, 20 Apr 2016 15:55:14 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Icedove/38.6.0 MIME-Version: 1.0 In-Reply-To: <1460638414-5987-3-git-send-email-jszhang@marvell.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1108 Lines: 33 On 04/14/2016 03:53 PM, Jisheng Zhang wrote: > If i2c_dw_probe() fail, we should call i2c_dw_plat_prepare_clk() to > disable and unprepare the clk, otherwise the clk enable and prepare > is left unbalanced. > > Signed-off-by: Jisheng Zhang > --- > drivers/i2c/busses/i2c-designware-platdrv.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/drivers/i2c/busses/i2c-designware-platdrv.c b/drivers/i2c/busses/i2c-designware-platdrv.c > index 00f9e99..1488cea 100644 > --- a/drivers/i2c/busses/i2c-designware-platdrv.c > +++ b/drivers/i2c/busses/i2c-designware-platdrv.c > @@ -268,6 +268,8 @@ rpm_disable: > pm_runtime_put_noidle(&pdev->dev); > } > > + i2c_dw_plat_prepare_clk(dev, false); > + > return r; > } > This is a bit unclear to me does devm_clk_get take care of clk disabling in case of probe error or driver removal? I see Andy's 1cb715ca4694 ("i2c-designware: move to managed functions (devm_*)") removed it but at quick look drivers/clk/clk-devres.c: devm_clk_release() calls only clk_put and I don't see disable is done down the path. -- Jarkko