Re: [patch] can: c_can: checking IS_ERR() instead of NULL

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

 



On 08/01/2014 10:53 AM, Dan Carpenter wrote:
> devm_ioremap() returns NULL on error, not an ERR_PTR().
> 
> Fixes: 33cf75656923 ('can: c_can_platform: Fix raminit, use devm_ioremap() instead of devm_ioremap_resource()')

Doh!

> Signed-off-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
> ---
> This will need to go to -stable because the patch which introduces the
> bug is going to be pushed to -stable.
> 
> diff --git a/drivers/net/can/c_can/c_can_platform.c b/drivers/net/can/c_can/c_can_platform.c
> index 5dede6e..109cb44 100644
> --- a/drivers/net/can/c_can/c_can_platform.c
> +++ b/drivers/net/can/c_can/c_can_platform.c
> @@ -280,7 +280,7 @@ static int c_can_plat_probe(struct platform_device *pdev)
>  
>  		priv->raminit_ctrlreg = devm_ioremap(&pdev->dev, res->start,
>  						     resource_size(res));
> -		if (IS_ERR(priv->raminit_ctrlreg) || priv->instance < 0)
> +		if (!priv->raminit_ctrlreg || priv->instance < 0)

What about using PTR_ERR_OR_ZERO()?

>  			dev_info(&pdev->dev, "control memory is not used for raminit\n");
>  		else
>  			priv->raminit = c_can_hw_raminit_ti;
> 

Marc

-- 
Pengutronix e.K.                  | Marc Kleine-Budde           |
Industrial Linux Solutions        | Phone: +49-231-2826-924     |
Vertretung West/Dortmund          | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |

Attachment: signature.asc
Description: OpenPGP digital signature


[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux