All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] can: c_can: fix error checking of priv->instance in probe()
@ 2013-08-21  9:48 Marc Kleine-Budde
  2013-08-21  9:52 ` Chen Gang
  0 siblings, 1 reply; 2+ messages in thread
From: Marc Kleine-Budde @ 2013-08-21  9:48 UTC (permalink / raw)
  To: linux-can; +Cc: gang.chen, anilkumar, tony, jg1.han, Marc Kleine-Budde

From: Chen Gang <gang.chen@asianux.com>

This patch adds a type cast from 'unsigned int' to 'int'.

'priv->instance' may less than zero, so need a type cast, the related
warnings (allmodconfig, "EXTRA_CFLAGS=-W"):

  drivers/net/can/c_can/c_can_platform.c:198:3: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits]

Signed-off-by: Chen Gang <gang.chen@asianux.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
Hello Chen Gang,

I've tweaked the commit message a bit. If there a no complains the patch will
be included in my next pull request to David.

Marc

 drivers/net/can/c_can/c_can_platform.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/can/c_can/c_can_platform.c b/drivers/net/can/c_can/c_can_platform.c
index c6f838d..294ced3 100644
--- a/drivers/net/can/c_can/c_can_platform.c
+++ b/drivers/net/can/c_can/c_can_platform.c
@@ -195,7 +195,7 @@ static int c_can_plat_probe(struct platform_device *pdev)
 
 		res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
 		priv->raminit_ctrlreg = devm_ioremap_resource(&pdev->dev, res);
-		if (IS_ERR(priv->raminit_ctrlreg) || priv->instance < 0)
+		if (IS_ERR(priv->raminit_ctrlreg) || (int)priv->instance < 0)
 			dev_info(&pdev->dev, "control memory is not used for raminit\n");
 		else
 			priv->raminit = c_can_hw_raminit;
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] can: c_can: fix error checking of priv->instance in probe()
  2013-08-21  9:48 [PATCH] can: c_can: fix error checking of priv->instance in probe() Marc Kleine-Budde
@ 2013-08-21  9:52 ` Chen Gang
  0 siblings, 0 replies; 2+ messages in thread
From: Chen Gang @ 2013-08-21  9:52 UTC (permalink / raw)
  To: Marc Kleine-Budde; +Cc: linux-can, anilkumar, tony, jg1.han

On 08/21/2013 05:48 PM, Marc Kleine-Budde wrote:
> From: Chen Gang <gang.chen@asianux.com>
> 
> This patch adds a type cast from 'unsigned int' to 'int'.
> 
> 'priv->instance' may less than zero, so need a type cast, the related
> warnings (allmodconfig, "EXTRA_CFLAGS=-W"):
> 
>   drivers/net/can/c_can/c_can_platform.c:198:3: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits]
> 
> Signed-off-by: Chen Gang <gang.chen@asianux.com>
> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
> ---
> Hello Chen Gang,
> 
> I've tweaked the commit message a bit. If there a no complains the patch will
> be included in my next pull request to David.
> 

Thank you for your tweaking.


> Marc
> 
>  drivers/net/can/c_can/c_can_platform.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/can/c_can/c_can_platform.c b/drivers/net/can/c_can/c_can_platform.c
> index c6f838d..294ced3 100644
> --- a/drivers/net/can/c_can/c_can_platform.c
> +++ b/drivers/net/can/c_can/c_can_platform.c
> @@ -195,7 +195,7 @@ static int c_can_plat_probe(struct platform_device *pdev)
>  
>  		res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
>  		priv->raminit_ctrlreg = devm_ioremap_resource(&pdev->dev, res);
> -		if (IS_ERR(priv->raminit_ctrlreg) || priv->instance < 0)
> +		if (IS_ERR(priv->raminit_ctrlreg) || (int)priv->instance < 0)
>  			dev_info(&pdev->dev, "control memory is not used for raminit\n");
>  		else
>  			priv->raminit = c_can_hw_raminit;
> 


Thanks.
-- 
Chen Gang

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-08-21  9:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-21  9:48 [PATCH] can: c_can: fix error checking of priv->instance in probe() Marc Kleine-Budde
2013-08-21  9:52 ` Chen Gang

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.