Skip to content

Commit

Permalink
serial: vt8500: add missing braces
Browse files Browse the repository at this point in the history
commit d969de8 upstream.

Due to missing braces on an if statement, in presence of a device_node a
port was always assigned -1, regardless of any alias entries in the
device tree. Conversely, if device_node was NULL, an unitialized port
ended up being used.

This patch adds the missing braces, fixing the issues.

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Acked-by: Tony Prisk <linux@prisktech.co.nz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Roel Kluin authored and Greg Kroah-Hartman committed Nov 4, 2013
1 parent 60fd01d commit 7c0cc78
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions drivers/tty/serial/vt8500_serial.c
Original file line number Diff line number Diff line change
Expand Up @@ -559,12 +559,13 @@ static int vt8500_serial_probe(struct platform_device *pdev)
if (!mmres || !irqres)
return -ENODEV;

if (np)
if (np) {
port = of_alias_get_id(np, "serial");
if (port >= VT8500_MAX_PORTS)
port = -1;
else
} else {
port = -1;
}

if (port < 0) {
/* calculate the port id */
Expand Down

0 comments on commit 7c0cc78

Please sign in to comment.