Skip to contentSkip to conversation

serial: trivial code flow simplification

PATCH New Bjorn Helgaas 1 participant 1 message Oct 2, 2006 TTY layer and serial drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 serial: trivial code flow simplification

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

drivers/serial/8250_pnp.c +4 -4
Index: work-mm2/drivers/serial/8250_pnp.c
===================================================================
@@ -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)