]> err.no Git - linux-2.6/commitdiff
[PATCH] serial: trivial code flow simplification
authorBjorn Helgaas <bjorn.helgaas@hp.com>
Wed, 14 Feb 2007 08:33:05 +0000 (00:33 -0800)
committerLinus Torvalds <torvalds@woody.linux-foundation.org>
Wed, 14 Feb 2007 16:09:52 +0000 (08:09 -0800)
Return failure immediately, so we don't have to test it twice.

Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
Cc: Adam Belay <ambx1@neo.rr.com>
Cc: Russell King <rmk@arm.linux.org.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
drivers/serial/8250_pnp.c

index d3d6b82706b5edbb548211187e96e28956859a4a..cde5db44abf6f136b601f65bf070ac1c31318ded 100644 (file)
@@ -450,11 +450,11 @@ serial_pnp_probe(struct pnp_dev *dev, const struct pnp_device_id *dev_id)
        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)