Re: [PATCH -next] drm/tegra: fix return value check

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Oct 21, 2013 at 11:34:07AM +0800, Wei Yongjun wrote:
> From: Wei Yongjun <yongjun_wei@xxxxxxxxxxxxxxxxx>
> 
> In case of error, the function clk_get_parent() and devm_ioremap_resource()
> returns ERR_PTR() and never returns NULL. The NULL test in the return value
> check should be replaced with IS_ERR().
> 
> Signed-off-by: Wei Yongjun <yongjun_wei@xxxxxxxxxxxxxxxxx>
> ---
>  drivers/gpu/drm/tegra/dsi.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)

I've applied this, but with the first hunk removed, since looking at the
implementation of clk_get_parent() it can actually return NULL. In fact
it seems like it will never return ERR_PTR().

I've also updated the commit message to reflect that.

Thierry

> 
> diff --git a/drivers/gpu/drm/tegra/dsi.c b/drivers/gpu/drm/tegra/dsi.c
> index 1cfbace..7bc2eeb 100644
> --- a/drivers/gpu/drm/tegra/dsi.c
> +++ b/drivers/gpu/drm/tegra/dsi.c
> @@ -914,7 +914,7 @@ static int tegra_dsi_setup_clocks(struct tegra_dsi *dsi)
>  	int err;
>  
>  	parent = clk_get_parent(dsi->clk);
> -	if (!parent)
> +	if (IS_ERR(parent))
>  		return -EINVAL;
>  
>  	err = clk_set_parent(parent, dsi->clk_parent);
> @@ -969,8 +969,8 @@ static int tegra_dsi_probe(struct platform_device *pdev)
>  
>  	regs = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>  	dsi->regs = devm_ioremap_resource(&pdev->dev, regs);
> -	if (!dsi->regs)
> -		return -EADDRNOTAVAIL;
> +	if (IS_ERR(dsi->regs))
> +		return PTR_ERR(dsi->regs);
>  
>  	INIT_LIST_HEAD(&dsi->client.list);
>  	dsi->client.ops = &dsi_client_ops;
> 

Attachment: pgp1oOepNx2zE.pgp
Description: PGP signature


[Index of Archives]     [ARM Kernel]     [Linux ARM]     [Linux ARM MSM]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux