mmc: sdhci-of-arasan: Disable clk_xin clock in the remove
Subsystems (3)
PATCH 1/1 mmc: sdhci-of-arasan: Disable clk_xin clock in the remove
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).
--- drivers/mmc/host/sdhci-of-arasan.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/mmc/host/sdhci-of-arasan.c +4 -0
@@ -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; }
Signature · 1 line
2.9.5
Quoted 16 lines · Flavio Ceolin
clk_xinis properly prepared/enabled onsdhci_arasan_probe(), and unprepared/disabled in the error path, but it is not being unprepared/disabled onsdhci_arasan_remove().Found by Linux Driver Verification project (linuxtesting.org).
Signed-off-by Flavio Ceolin <[email protected]>--- drivers/mmc/host/sdhci-of-arasan.c | 4 ++++ 1 file changed, 4 insertions(+)drivers/mmc/host/sdhci-of-arasan.c +0
-0
drivers/mmc/host/sdhci-of-arasan.c static int sdhci_arasan_remove(struct platform_device *pdev) · line 695
Quoted 4 lines
drivers/mmc/host/sdhci-of-arasan.c +1
-0@@ -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.
drivers/mmc/host/sdhci-of-arasan.c static int sdhci_arasan_remove(struct platform_device *pdev) · line 709
Quoted 8 lines
drivers/mmc/host/sdhci-of-arasan.c +1
-0if (!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.
drivers/mmc/host/sdhci-of-arasan.c static int sdhci_arasan_remove(struct platform_device *pdev) · line 714
Quoted 6 lines
drivers/mmc/host/sdhci-of-arasan.c +2
-0+clk_disable_unprepare (clk_xin); +return ret; }
It means NACK from me.
Thanks,
Michal
Hi Michal,
Quoted 25 lines · Flavio Ceolin
Quoted 16 lines
clk_xinis properly prepared/enabled onsdhci_arasan_probe(), and unprepared/disabled in the error path, but it is not being unprepared/disabled onsdhci_arasan_remove().Found by Linux Driver Verification project (linuxtesting.org).
Signed-off-by Flavio Ceolin <[email protected]>--- drivers/mmc/host/sdhci-of-arasan.c | 4 ++++ 1 file changed, 4 insertions(+)drivers/mmc/host/sdhci-of-arasan.c +0
-0drivers/mmc/host/sdhci-of-arasan.c static int sdhci_arasan_remove(struct platform_device *pdev) · line 695
Quoted 4 lines
drivers/mmc/host/sdhci-of-arasan.c +1
-0@@ -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;
Quoted 3 lines
And if you look at
sdhci_pltfm_unregisteryou will find out thatclk_disable_unprepare(pltfm_host->clk);
is called there.
Yep, I confirm that. You're right, the patch is wrong, sorry for that :)
Quoted 21 lines
drivers/mmc/host/sdhci-of-arasan.c static int sdhci_arasan_remove(struct platform_device *pdev) · line 709
Quoted 9 lines
drivers/mmc/host/sdhci-of-arasan.c +1
-0if (!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_xinis required property.drivers/mmc/host/sdhci-of-arasan.c static int sdhci_arasan_remove(struct platform_device *pdev) · line 714
Quoted 6 lines
drivers/mmc/host/sdhci-of-arasan.c +2
-0+clk_disable_unprepare (clk_xin); +return ret; }It means NACK from me.
Quoted 2 lines
Thanks,
Michal
Regards,
Flavio Ceolin