[PATCH] tty:hvcs: Move Assignment for hvcsd->port.count

Bryant G. Ly bryantly at linux.vnet.ibm.com
Tue Apr 3 00:53:49 AEST 2018


Move the assignment out of hvcsd->port.count from within the
if () block so this patch fixes it. It is bad practice to have
assignments within an if () block.

Signed-off-by: Bryant G. Ly <bryantly at linux.vnet.ibm.com>
---
 drivers/tty/hvc/hvcs.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/tty/hvc/hvcs.c b/drivers/tty/hvc/hvcs.c
index 1db1d97..333dc76 100644
--- a/drivers/tty/hvc/hvcs.c
+++ b/drivers/tty/hvc/hvcs.c
@@ -1202,7 +1202,8 @@ static void hvcs_close(struct tty_struct *tty, struct file *filp)
 	hvcsd = tty->driver_data;
 
 	spin_lock_irqsave(&hvcsd->lock, flags);
-	if (--hvcsd->port.count == 0) {
+	--hvcsd->port.count;
+	if (hvcsd->port.count == 0) {
 
 		vio_disable_interrupts(hvcsd->vdev);
 
-- 
2.7.2



More information about the Linuxppc-dev mailing list