public inbox for linux-mmc@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mmc: sdhci-of-arasan: Disable clk_xin clock in the remove
@ 2017-12-12  8:19 Flavio Ceolin
  2017-12-12  9:37 ` Michal Simek
  0 siblings, 1 reply; 3+ messages in thread
From: Flavio Ceolin @ 2017-12-12  8:19 UTC (permalink / raw)
  To: linux-kernel
  Cc: Ulf Hansson,
	open list:SECURE DIGITAL HOST CONTROLLER INTERFACE SDHCI...,
	Michal Simek, Adrian Hunter, Flavio Ceolin,
	moderated list:ARM/ZYNQ ARCHITECTURE

clk_xin is properly prepared/enabled on sdhci_arasan_probe(), and
unprepared/disabled in the error path, but it is not being
unprepared/disabled on sdhci_arasan_remove().

Found by Linux Driver Verification project (linuxtesting.org).

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
---
 drivers/mmc/host/sdhci-of-arasan.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/mmc/host/sdhci-of-arasan.c b/drivers/mmc/host/sdhci-of-arasan.c
index 0720ea7..69bd260 100644
--- a/drivers/mmc/host/sdhci-of-arasan.c
+++ b/drivers/mmc/host/sdhci-of-arasan.c
@@ -692,6 +692,7 @@ static int sdhci_arasan_remove(struct platform_device *pdev)
 	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
 	struct sdhci_arasan_data *sdhci_arasan = sdhci_pltfm_priv(pltfm_host);
 	struct clk *clk_ahb = sdhci_arasan->clk_ahb;
+	struct clk *clk_xin = devm_clk_get(&pdev->dev, "clk_xin");
 
 	if (!IS_ERR(sdhci_arasan->phy)) {
 		if (sdhci_arasan->is_phy_on)
@@ -705,6 +706,9 @@ static int sdhci_arasan_remove(struct platform_device *pdev)
 
 	clk_disable_unprepare(clk_ahb);
 
+	if (!IS_ERR(clk_xin))
+		clk_disable_unprepare(clk_xin);
+
 	return ret;
 }
 
-- 
2.9.5

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] mmc: sdhci-of-arasan: Disable clk_xin clock in the remove
  2017-12-12  8:19 [PATCH] mmc: sdhci-of-arasan: Disable clk_xin clock in the remove Flavio Ceolin
@ 2017-12-12  9:37 ` Michal Simek
  2017-12-12 17:15   ` Flavio Ceolin
  0 siblings, 1 reply; 3+ messages in thread
From: Michal Simek @ 2017-12-12  9:37 UTC (permalink / raw)
  To: Flavio Ceolin, linux-kernel
  Cc: Michal Simek, Adrian Hunter, Ulf Hansson,
	moderated list:ARM/ZYNQ ARCHITECTURE,
	open list:SECURE DIGITAL HOST CONTROLLER INTERFACE (SDHCI...)

On 12.12.2017 09:19, Flavio Ceolin wrote:
> clk_xin is properly prepared/enabled on sdhci_arasan_probe(), and
> unprepared/disabled in the error path, but it is not being
> unprepared/disabled on sdhci_arasan_remove().
> 
> Found by Linux Driver Verification project (linuxtesting.org).
> 
> Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
> ---
>  drivers/mmc/host/sdhci-of-arasan.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/mmc/host/sdhci-of-arasan.c b/drivers/mmc/host/sdhci-of-arasan.c
> index 0720ea7..69bd260 100644
> --- a/drivers/mmc/host/sdhci-of-arasan.c
> +++ b/drivers/mmc/host/sdhci-of-arasan.c
> @@ -692,6 +692,7 @@ static int sdhci_arasan_remove(struct platform_device *pdev)
>  	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
>  	struct sdhci_arasan_data *sdhci_arasan = sdhci_pltfm_priv(pltfm_host);
>  	struct clk *clk_ahb = sdhci_arasan->clk_ahb;
> +	struct clk *clk_xin = devm_clk_get(&pdev->dev, "clk_xin");

I don't think this is right. You have already asked for this clock in
probe. It means you should reuse pltfm_host->clk = clk_xin;

And if you look at sdhci_pltfm_unregister you will find out that
clk_disable_unprepare(pltfm_host->clk);
is called there.

>  
>  	if (!IS_ERR(sdhci_arasan->phy)) {
>  		if (sdhci_arasan->is_phy_on)
> @@ -705,6 +706,9 @@ static int sdhci_arasan_remove(struct platform_device *pdev)
>  
>  	clk_disable_unprepare(clk_ahb);
>  
> +	if (!IS_ERR(clk_xin))

And clk_xin is required property.

> +		clk_disable_unprepare(clk_xin);
> +
>  	return ret;
>  }
>  
> 

It means NACK from me.

Thanks,
Michal

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] mmc: sdhci-of-arasan: Disable clk_xin clock in the remove
  2017-12-12  9:37 ` Michal Simek
@ 2017-12-12 17:15   ` Flavio Ceolin
  0 siblings, 0 replies; 3+ messages in thread
From: Flavio Ceolin @ 2017-12-12 17:15 UTC (permalink / raw)
  To: linux-kernel
  Cc: Michal Simek, Adrian Hunter, Ulf Hansson,
	moderated list:ARM/ZYNQ ARCHITECTURE,
	open list:SECURE DIGITAL HOST CONTROLLER INTERFACE (SDHCI...)

Hi Michal,

> On 12.12.2017 09:19, Flavio Ceolin wrote:
>> clk_xin is properly prepared/enabled on sdhci_arasan_probe(), and
>> unprepared/disabled in the error path, but it is not being
>> unprepared/disabled on sdhci_arasan_remove().
>> 
>> Found by Linux Driver Verification project (linuxtesting.org).
>> 
>> Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
>> ---
>>  drivers/mmc/host/sdhci-of-arasan.c | 4 ++++
>>  1 file changed, 4 insertions(+)
>> 
>> diff --git a/drivers/mmc/host/sdhci-of-arasan.c b/drivers/mmc/host/sdhci-of-arasan.c
>> index 0720ea7..69bd260 100644
>> --- a/drivers/mmc/host/sdhci-of-arasan.c
>> +++ b/drivers/mmc/host/sdhci-of-arasan.c
>> @@ -692,6 +692,7 @@ static int sdhci_arasan_remove(struct platform_device *pdev)
>>  	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
>>  	struct sdhci_arasan_data *sdhci_arasan = sdhci_pltfm_priv(pltfm_host);
>>  	struct clk *clk_ahb = sdhci_arasan->clk_ahb;
>> +	struct clk *clk_xin = devm_clk_get(&pdev->dev, "clk_xin");
>
> I don't think this is right. You have already asked for this clock in
> probe. It means you should reuse pltfm_host->clk = clk_xin;
>
> And if you look at sdhci_pltfm_unregister you will find out that
> clk_disable_unprepare(pltfm_host->clk);
> is called there.

Yep, I confirm that. You're right, the patch is wrong, sorry for that :)
>
>>  
>>  	if (!IS_ERR(sdhci_arasan->phy)) {
>>  		if (sdhci_arasan->is_phy_on)
>> @@ -705,6 +706,9 @@ static int sdhci_arasan_remove(struct platform_device *pdev)
>>  
>>  	clk_disable_unprepare(clk_ahb);
>>  
>> +	if (!IS_ERR(clk_xin))
>
> And clk_xin is required property.
>
>> +		clk_disable_unprepare(clk_xin);
>> +
>>  	return ret;
>>  }
>>  
>> 
>
> It means NACK from me.
>
> Thanks,
> Michal

Regards,
Flavio Ceolin

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-12-12 17:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-12-12  8:19 [PATCH] mmc: sdhci-of-arasan: Disable clk_xin clock in the remove Flavio Ceolin
2017-12-12  9:37 ` Michal Simek
2017-12-12 17:15   ` Flavio Ceolin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox