From: Bjorn Helgaas Date: Wed, 14 Feb 2007 08:33:05 +0000 (-0800) Subject: [PATCH] serial: trivial code flow simplification X-Git-Tag: v2.6.21-rc1~260 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9b22271d4b8c1be8a81563c322d3f04e7cbe2153;p=linux-2.6 [PATCH] serial: trivial code flow simplification Return failure immediately, so we don't have to test it twice. Signed-off-by: Bjorn Helgaas Cc: Adam Belay Cc: Russell King Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/drivers/serial/8250_pnp.c b/drivers/serial/8250_pnp.c index d3d6b82706..cde5db44ab 100644 --- a/drivers/serial/8250_pnp.c +++ b/drivers/serial/8250_pnp.c @@ -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)