Skip to contentSkip to conversation

drivers: net: can: c_can: add type cast from 'unsigned int' to 'int'

PATCH In review Chen Gang 2 participants 3 messages Aug 21, 2013

Subsystems (3)
lore
Share & tools
lore

Chen Gang

author
#0 lore raw

PATCH 1/1 drivers: net: can: c_can: add 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]

---
 drivers/net/can/c_can/c_can_platform.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/net/can/c_can/c_can_platform.c +1 -1
index c6f838d..294ced3 100644
@@ -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;
Signature · 1 line
1.7.7.6
#1 lore raw
Quoted 4 lines · Chen Gang

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

Tnx, I've tweaked the commit message a bit, will send a v2.

Marc

Signature · 4 lines
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   |
author
#2 lore raw
Quoted 8 lines · Marc Kleine-Budde
Quoted 4 lines · Chen Gang

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

Tnx, I've tweaked the commit message a bit, will send a v2.

OK, thanks.

Quoted 2 lines

Marc

Signature · 1 line
Chen Gang