Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

can: c_can: fix error checking of priv->instance in probe()

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>

authored by

Chen Gang and committed by
Marc Kleine-Budde
6439fbce f8825669

+1 -1
+1 -1
drivers/net/can/c_can/c_can_platform.c
··· 195 195 196 196 res = platform_get_resource(pdev, IORESOURCE_MEM, 1); 197 197 priv->raminit_ctrlreg = devm_ioremap_resource(&pdev->dev, res); 198 - if (IS_ERR(priv->raminit_ctrlreg) || priv->instance < 0) 198 + if (IS_ERR(priv->raminit_ctrlreg) || (int)priv->instance < 0) 199 199 dev_info(&pdev->dev, "control memory is not used for raminit\n"); 200 200 else 201 201 priv->raminit = c_can_hw_raminit;