[patch] serial: trivial code flow simplification

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Return failure immediately, so we don't have to test it twice.

Signed-off-by: Bjorn Helgaas <bjorn.helgaas@xxxxxx>

Index: work-mm2/drivers/serial/8250_pnp.c
===================================================================
--- work-mm2.orig/drivers/serial/8250_pnp.c	2006-08-18 13:02:48.000000000 -0600
+++ work-mm2/drivers/serial/8250_pnp.c	2006-08-18 13:04:14.000000000 -0600
@@ -437,11 +437,11 @@
 	port.dev = &dev->dev;
 
 	line = serial8250_register_port(&port);
+	if (line < 0)
+		return -ENODEV;
 
-	if (line >= 0)
-		pnp_set_drvdata(dev, (void *)((long)line + 1));
-	return line >= 0 ? 0 : -ENODEV;
-
+	pnp_set_drvdata(dev, (void *)((long)line + 1));
+	return 0;
 }
 
 static void __devexit serial_pnp_remove(struct pnp_dev *dev)
-
To unsubscribe from this list: send the line "unsubscribe linux-serial" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux PPP]     [Linux FS]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Linmodem]     [Device Mapper]     [Linux Kernel for ARM]

  Powered by Linux