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

tty/serial: digicolor: Fix bad usage of IS_ERR_VALUE

IS_ERR_VALUE() assumes that its parameter is an unsigned long.
It can not be used to check if an unsigned int reflects an error.
Doing so can result in the following build warning.

drivers/tty/serial/digicolor-usart.c: In function ‘digicolor_uart_probe’:
include/linux/err.h:21:38: warning:
comparison is always false due to limited range of data type
drivers/tty/serial/digicolor-usart.c:485:6: note:
in expansion of macro ‘IS_ERR_VALUE’

If that warning is seen, an error return from platform_get_irq() is missed.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Acked-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Guenter Roeck and committed by
Greg Kroah-Hartman
dd9b5588 8f5405c9

+5 -4
+5 -4
drivers/tty/serial/digicolor-usart.c
··· 453 453 static int digicolor_uart_probe(struct platform_device *pdev) 454 454 { 455 455 struct device_node *np = pdev->dev.of_node; 456 - int ret, index; 456 + int irq, ret, index; 457 457 struct digicolor_port *dp; 458 458 struct resource *res; 459 459 struct clk *uart_clk; ··· 481 481 if (IS_ERR(dp->port.membase)) 482 482 return PTR_ERR(dp->port.membase); 483 483 484 - dp->port.irq = platform_get_irq(pdev, 0); 485 - if (IS_ERR_VALUE(dp->port.irq)) 486 - return dp->port.irq; 484 + irq = platform_get_irq(pdev, 0); 485 + if (irq < 0) 486 + return irq; 487 + dp->port.irq = irq; 487 488 488 489 dp->port.iotype = UPIO_MEM; 489 490 dp->port.uartclk = clk_get_rate(uart_clk);