diff options
author | Tang Bin <tangbin@cmss.chinamobile.com> | 2021-08-11 12:51:36 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2021-08-13 09:11:21 +0200 |
commit | 217b04c67b6bca03a484bf8cad44596a34a9de4c (patch) | |
tree | 9750e442ad975a37871315d56d46b0885c536b36 /drivers/tty | |
parent | Merge 5.14-rc5 into tty-next (diff) | |
download | linux-217b04c67b6bca03a484bf8cad44596a34a9de4c.tar.xz linux-217b04c67b6bca03a484bf8cad44596a34a9de4c.zip |
serial: stm32: fix the conditional expression writing
In the function stm32_usart_init_port, intent of the code maybe when
irq returns a value of zero, the return should be '-ENODEV'. But the
conditional expression '? :' maybe clerical error, it should be
'?:' to make '-ENODEV' work.
But in fact, as the example in platform.c is
* int irq = platform_get_irq(pdev, 0);
* if (irq < 0)
* return irq;
So the return value of zero is unnecessary to check, at last remove
the unnecessary '?: -ENODEV'.
Co-developed-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com>
Signed-off-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com>
Signed-off-by: Tang Bin <tangbin@cmss.chinamobile.com>
Link: https://lore.kernel.org/r/20210811105136.25392-1-tangbin@cmss.chinamobile.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty')
-rw-r--r-- | drivers/tty/serial/stm32-usart.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/tty/serial/stm32-usart.c b/drivers/tty/serial/stm32-usart.c index ef793b3b4591..090822cd1604 100644 --- a/drivers/tty/serial/stm32-usart.c +++ b/drivers/tty/serial/stm32-usart.c @@ -1034,8 +1034,8 @@ static int stm32_usart_init_port(struct stm32_port *stm32port, int ret, irq; irq = platform_get_irq(pdev, 0); - if (irq <= 0) - return irq ? : -ENODEV; + if (irq < 0) + return irq; port->iotype = UPIO_MEM; port->flags = UPF_BOOT_AUTOCONF; |