gpu: host1x: Fix error handling

Message ID 20170410202922.17665-1-christophe.jaillet@wanadoo.fr
State New
Headers show

Commit Message

Christophe JAILLET April 10, 2017, 8:29 p.m.
If 'devm_reset_control_get' returns an error, then we erroneously return
success because error code is taken from 'host->clk' instead of 
'host->rst'.

Fixes: b386c6b73ac6 ("gpu: host1x: Support module reset")

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
 drivers/gpu/host1x/dev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Mikko Perttunen April 11, 2017, 8:38 a.m. | #1
On 10.04.2017 23:29, Christophe JAILLET wrote:
> If 'devm_reset_control_get' returns an error, then we erroneously return
> success because error code is taken from 'host->clk' instead of
> 'host->rst'.
>
> Fixes: b386c6b73ac6 ("gpu: host1x: Support module reset")
>
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
>  drivers/gpu/host1x/dev.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/host1x/dev.c b/drivers/gpu/host1x/dev.c
> index f05ebb14fa63..ac65f52850a6 100644
> --- a/drivers/gpu/host1x/dev.c
> +++ b/drivers/gpu/host1x/dev.c
> @@ -172,7 +172,7 @@ static int host1x_probe(struct platform_device *pdev)
>
>  	host->rst = devm_reset_control_get(&pdev->dev, "host1x");
>  	if (IS_ERR(host->rst)) {
> -		err = PTR_ERR(host->clk);
> +		err = PTR_ERR(host->rst);
>  		dev_err(&pdev->dev, "failed to get reset: %d\n", err);
>  		return err;
>  	}
>

Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
--
To unsubscribe from this list: send the line "unsubscribe linux-tegra" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Thierry Reding June 15, 2017, 12:07 p.m. | #2
On Mon, Apr 10, 2017 at 10:29:22PM +0200, Christophe JAILLET wrote:
> If 'devm_reset_control_get' returns an error, then we erroneously return
> success because error code is taken from 'host->clk' instead of 
> 'host->rst'.
> 
> Fixes: b386c6b73ac6 ("gpu: host1x: Support module reset")
> 
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
>  drivers/gpu/host1x/dev.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Applied to drm-misc-fixes, thanks.

Thierry

Patch

diff --git a/drivers/gpu/host1x/dev.c b/drivers/gpu/host1x/dev.c
index f05ebb14fa63..ac65f52850a6 100644
--- a/drivers/gpu/host1x/dev.c
+++ b/drivers/gpu/host1x/dev.c
@@ -172,7 +172,7 @@  static int host1x_probe(struct platform_device *pdev)
 
 	host->rst = devm_reset_control_get(&pdev->dev, "host1x");
 	if (IS_ERR(host->rst)) {
-		err = PTR_ERR(host->clk);
+		err = PTR_ERR(host->rst);
 		dev_err(&pdev->dev, "failed to get reset: %d\n", err);
 		return err;
 	}