lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20210811105136.25392-1-tangbin@cmss.chinamobile.com>
Date:   Wed, 11 Aug 2021 18:51:36 +0800
From:   Tang Bin <tangbin@...s.chinamobile.com>
To:     gregkh@...uxfoundation.org, jirislaby@...nel.org,
        mcoquelin.stm32@...il.com, alexandre.torgue@...s.st.com
Cc:     linux-serial@...r.kernel.org,
        linux-stm32@...md-mailman.stormreply.com,
        linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
        Tang Bin <tangbin@...s.chinamobile.com>,
        Zhang Shengju <zhangshengju@...s.chinamobile.com>
Subject: [PATCH] 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@...s.chinamobile.com>
Signed-off-by: Zhang Shengju <zhangshengju@...s.chinamobile.com>
Signed-off-by: Tang Bin <tangbin@...s.chinamobile.com>
---
 drivers/tty/serial/stm32-usart.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/tty/serial/stm32-usart.c b/drivers/tty/serial/stm32-usart.c
index ef793b3b4..090822cd1 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;
-- 
2.20.1.windows.1



Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ