linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mmc: sdhci-pxav2: add error handling of clk_prepare_enable()
@ 2017-02-10 22:54 Alexey Khoroshilov
  2017-02-28 11:55 ` Adrian Hunter
  2017-03-14 16:21 ` Ulf Hansson
  0 siblings, 2 replies; 3+ messages in thread
From: Alexey Khoroshilov @ 2017-02-10 22:54 UTC (permalink / raw)
  To: Adrian Hunter, Ulf Hansson
  Cc: Alexey Khoroshilov, linux-mmc, linux-kernel, ldv-project

There is no check if clk_prepare_enable() succeed in sdhci_pxav2_probe().

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

Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
---
 drivers/mmc/host/sdhci-pxav2.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/mmc/host/sdhci-pxav2.c b/drivers/mmc/host/sdhci-pxav2.c
index 347eae2d7b6a..80513f54e9d4 100644
--- a/drivers/mmc/host/sdhci-pxav2.c
+++ b/drivers/mmc/host/sdhci-pxav2.c
@@ -185,7 +185,11 @@ static int sdhci_pxav2_probe(struct platform_device *pdev)
 		goto err_clk_get;
 	}
 	pltfm_host->clk = clk;
-	clk_prepare_enable(clk);
+	ret = clk_prepare_enable(clk);
+	if (ret) {
+		dev_err(&pdev->dev, "failed to enable io clock\n");
+		goto err_clk_enable;
+	}
 
 	host->quirks = SDHCI_QUIRK_BROKEN_ADMA
 		| SDHCI_QUIRK_BROKEN_TIMEOUT_VAL
@@ -228,6 +232,7 @@ static int sdhci_pxav2_probe(struct platform_device *pdev)
 
 err_add_host:
 	clk_disable_unprepare(clk);
+err_clk_enable:
 	clk_put(clk);
 err_clk_get:
 	sdhci_pltfm_free(pdev);
-- 
2.7.4

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

* Re: [PATCH] mmc: sdhci-pxav2: add error handling of clk_prepare_enable()
  2017-02-10 22:54 [PATCH] mmc: sdhci-pxav2: add error handling of clk_prepare_enable() Alexey Khoroshilov
@ 2017-02-28 11:55 ` Adrian Hunter
  2017-03-14 16:21 ` Ulf Hansson
  1 sibling, 0 replies; 3+ messages in thread
From: Adrian Hunter @ 2017-02-28 11:55 UTC (permalink / raw)
  To: Alexey Khoroshilov, Ulf Hansson
  Cc: linux-mmc, linux-kernel, ldv-project, Jisheng Zhang

On 11/02/17 00:54, Alexey Khoroshilov wrote:
> There is no check if clk_prepare_enable() succeed in sdhci_pxav2_probe().
> 
> Found by Linux Driver Verification project (linuxtesting.org).
> 
> Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>

Acked-by: Adrian Hunter <adrian.hunter@intel.com>

> ---
>  drivers/mmc/host/sdhci-pxav2.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/mmc/host/sdhci-pxav2.c b/drivers/mmc/host/sdhci-pxav2.c
> index 347eae2d7b6a..80513f54e9d4 100644
> --- a/drivers/mmc/host/sdhci-pxav2.c
> +++ b/drivers/mmc/host/sdhci-pxav2.c
> @@ -185,7 +185,11 @@ static int sdhci_pxav2_probe(struct platform_device *pdev)
>  		goto err_clk_get;
>  	}
>  	pltfm_host->clk = clk;
> -	clk_prepare_enable(clk);
> +	ret = clk_prepare_enable(clk);
> +	if (ret) {
> +		dev_err(&pdev->dev, "failed to enable io clock\n");
> +		goto err_clk_enable;
> +	}
>  
>  	host->quirks = SDHCI_QUIRK_BROKEN_ADMA
>  		| SDHCI_QUIRK_BROKEN_TIMEOUT_VAL
> @@ -228,6 +232,7 @@ static int sdhci_pxav2_probe(struct platform_device *pdev)
>  
>  err_add_host:
>  	clk_disable_unprepare(clk);
> +err_clk_enable:
>  	clk_put(clk);
>  err_clk_get:
>  	sdhci_pltfm_free(pdev);
> 

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

* Re: [PATCH] mmc: sdhci-pxav2: add error handling of clk_prepare_enable()
  2017-02-10 22:54 [PATCH] mmc: sdhci-pxav2: add error handling of clk_prepare_enable() Alexey Khoroshilov
  2017-02-28 11:55 ` Adrian Hunter
@ 2017-03-14 16:21 ` Ulf Hansson
  1 sibling, 0 replies; 3+ messages in thread
From: Ulf Hansson @ 2017-03-14 16:21 UTC (permalink / raw)
  To: Alexey Khoroshilov; +Cc: Adrian Hunter, linux-mmc, linux-kernel, ldv-project

On 10 February 2017 at 23:54, Alexey Khoroshilov <khoroshilov@ispras.ru> wrote:
> There is no check if clk_prepare_enable() succeed in sdhci_pxav2_probe().
>
> Found by Linux Driver Verification project (linuxtesting.org).
>
> Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>

Thanks, applied for next!

Kind regards
Uffe

> ---
>  drivers/mmc/host/sdhci-pxav2.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/mmc/host/sdhci-pxav2.c b/drivers/mmc/host/sdhci-pxav2.c
> index 347eae2d7b6a..80513f54e9d4 100644
> --- a/drivers/mmc/host/sdhci-pxav2.c
> +++ b/drivers/mmc/host/sdhci-pxav2.c
> @@ -185,7 +185,11 @@ static int sdhci_pxav2_probe(struct platform_device *pdev)
>                 goto err_clk_get;
>         }
>         pltfm_host->clk = clk;
> -       clk_prepare_enable(clk);
> +       ret = clk_prepare_enable(clk);
> +       if (ret) {
> +               dev_err(&pdev->dev, "failed to enable io clock\n");
> +               goto err_clk_enable;
> +       }
>
>         host->quirks = SDHCI_QUIRK_BROKEN_ADMA
>                 | SDHCI_QUIRK_BROKEN_TIMEOUT_VAL
> @@ -228,6 +232,7 @@ static int sdhci_pxav2_probe(struct platform_device *pdev)
>
>  err_add_host:
>         clk_disable_unprepare(clk);
> +err_clk_enable:
>         clk_put(clk);
>  err_clk_get:
>         sdhci_pltfm_free(pdev);
> --
> 2.7.4
>

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

end of thread, other threads:[~2017-03-14 16:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-10 22:54 [PATCH] mmc: sdhci-pxav2: add error handling of clk_prepare_enable() Alexey Khoroshilov
2017-02-28 11:55 ` Adrian Hunter
2017-03-14 16:21 ` Ulf Hansson

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).