All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marc Kleine-Budde <mkl@pengutronix.de>
To: Dan Carpenter <dan.carpenter@oracle.com>,
	Wolfgang Grandegger <wg@grandegger.com>,
	George Cherian <george.cherian@ti.com>
Cc: Grant Likely <grant.likely@linaro.org>,
	Rob Herring <robh+dt@kernel.org>,
	Thor Thayer <tthayer@altera.com>, Pavel Machek <pavel@denx.de>,
	Mugunthan V N <mugunthanvnm@ti.com>,
	"Lad, Prabhakar" <prabhakar.csengg@gmail.com>,
	Wolfram Sang <wsa@sang-engineering.com>,
	linux-can@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [patch] can: c_can: checking IS_ERR() instead of NULL
Date: Fri, 01 Aug 2014 09:01:36 +0000	[thread overview]
Message-ID: <53DB5770.7040808@pengutronix.de> (raw)
In-Reply-To: <20140801085344.GA31702@mwanda>

[-- Attachment #1: Type: text/plain, Size: 1410 bytes --]

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@oracle.com>
> ---
> 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 #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 242 bytes --]

WARNING: multiple messages have this Message-ID (diff)
From: Marc Kleine-Budde <mkl@pengutronix.de>
To: Dan Carpenter <dan.carpenter@oracle.com>,
	Wolfgang Grandegger <wg@grandegger.com>,
	George Cherian <george.cherian@ti.com>
Cc: Grant Likely <grant.likely@linaro.org>,
	Rob Herring <robh+dt@kernel.org>,
	Thor Thayer <tthayer@altera.com>, Pavel Machek <pavel@denx.de>,
	Mugunthan V N <mugunthanvnm@ti.com>,
	"Lad, Prabhakar" <prabhakar.csengg@gmail.com>,
	Wolfram Sang <wsa@sang-engineering.com>,
	linux-can@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [patch] can: c_can: checking IS_ERR() instead of NULL
Date: Fri, 01 Aug 2014 11:01:36 +0200	[thread overview]
Message-ID: <53DB5770.7040808@pengutronix.de> (raw)
In-Reply-To: <20140801085344.GA31702@mwanda>

[-- Attachment #1: Type: text/plain, Size: 1410 bytes --]

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@oracle.com>
> ---
> 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 #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 242 bytes --]

  reply	other threads:[~2014-08-01  9:01 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-01  8:53 [patch] can: c_can: checking IS_ERR() instead of NULL Dan Carpenter
2014-08-01  8:53 ` Dan Carpenter
2014-08-01  9:01 ` Marc Kleine-Budde [this message]
2014-08-01  9:01   ` Marc Kleine-Budde
2014-08-01  9:13   ` Dan Carpenter
2014-08-01  9:13     ` Dan Carpenter
2014-08-01  9:15     ` Marc Kleine-Budde
2014-08-01  9:15       ` Marc Kleine-Budde
2014-08-01 18:16 ` Wolfram Sang
2014-08-01 18:16   ` Wolfram Sang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=53DB5770.7040808@pengutronix.de \
    --to=mkl@pengutronix.de \
    --cc=dan.carpenter@oracle.com \
    --cc=george.cherian@ti.com \
    --cc=grant.likely@linaro.org \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-can@vger.kernel.org \
    --cc=mugunthanvnm@ti.com \
    --cc=pavel@denx.de \
    --cc=prabhakar.csengg@gmail.com \
    --cc=robh+dt@kernel.org \
    --cc=tthayer@altera.com \
    --cc=wg@grandegger.com \
    --cc=wsa@sang-engineering.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.