[-next] soc/tegra: Fix wrong pointer passed to PTR_ERR()

Message ID 20170416040655.10237-1-weiyj.lk@gmail.com
State Superseded, archived
Headers show

Commit Message

Wei Yongjun April 16, 2017, 4:06 a.m.
From: Wei Yongjun <weiyongjun1@huawei.com>

PTR_ERR should access the value just tested by IS_ERR, otherwise
the wrong error code will be returned.

Fixes: 841fd94c43a4 ("soc/tegra: flowctrl: Add basic platform driver")
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
---
 drivers/soc/tegra/flowctrl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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

Comments

Jon Hunter April 24, 2017, 2:47 p.m. | #1
On 16/04/17 05:06, Wei Yongjun wrote:
> From: Wei Yongjun <weiyongjun1@huawei.com>
> 
> PTR_ERR should access the value just tested by IS_ERR, otherwise
> the wrong error code will be returned.
> 
> Fixes: 841fd94c43a4 ("soc/tegra: flowctrl: Add basic platform driver")
> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
> ---
>  drivers/soc/tegra/flowctrl.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/soc/tegra/flowctrl.c b/drivers/soc/tegra/flowctrl.c
> index 0e345c0..5433cc7 100644
> --- a/drivers/soc/tegra/flowctrl.c
> +++ b/drivers/soc/tegra/flowctrl.c
> @@ -157,7 +157,7 @@ static int tegra_flowctrl_probe(struct platform_device *pdev)
>  	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>  	tegra_flowctrl_base = devm_ioremap_resource(&pdev->dev, res);
>  	if (IS_ERR(tegra_flowctrl_base))
> -		return PTR_ERR(base);
> +		return PTR_ERR(tegra_flowctrl_base);
>  
>  	iounmap(base);

Thanks. However, we have already received a fix for this here [0].

Jon

[0] https://patchwork.ozlabs.org/patch/749329/

Patch

diff --git a/drivers/soc/tegra/flowctrl.c b/drivers/soc/tegra/flowctrl.c
index 0e345c0..5433cc7 100644
--- a/drivers/soc/tegra/flowctrl.c
+++ b/drivers/soc/tegra/flowctrl.c
@@ -157,7 +157,7 @@  static int tegra_flowctrl_probe(struct platform_device *pdev)
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	tegra_flowctrl_base = devm_ioremap_resource(&pdev->dev, res);
 	if (IS_ERR(tegra_flowctrl_base))
-		return PTR_ERR(base);
+		return PTR_ERR(tegra_flowctrl_base);
 
 	iounmap(base);