logo       

[patch] serial: trivial code flow simplification: msg#00003

linux.serial

Subject: [patch] serial: trivial code flow simplification

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



<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise