Skip to contentSkip to conversation

tty: serial/vt8500_serial.c: fix bug caused by missing "{}"

PATCH In review Cong Ding 2 participants 2 messages Jan 16, 2013

Subsystems (2)
lore
Share & tools
lore

Cong Ding

author
#0 lore raw

PATCH 1/1 tty: serial/vt8500_serial.c: fix bug caused by missing "{}"

It is obviously here should be braced by "{}" in the "if" branch (more than 1 line in the "if" branch), and by the
coding style document of the kernel I also add "{}" to the else branch.

---
 drivers/tty/serial/vt8500_serial.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/tty/serial/vt8500_serial.c +3 -2
index 8fd1814..ac46a6e 100644
@@ -567,12 +567,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 */
Signature · 1 line
1.7.10.4
#1 lore raw
Quoted 19 lines · Cong Ding

It is obviously here should be braced by "{}" in the "if" branch (more than 1 line in the "if" branch), and by the
coding style document of the kernel I also add "{}" to the else branch.

---
 drivers/tty/serial/vt8500_serial.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/tty/serial/vt8500_serial.c +1 -1
index 8fd1814..ac46a6e 100644
@@ -567,12 +567,13 @@ static int vt8500_serial_probe(struct platform_device *pdev)
 	if (!mmres || !irqres)
 		return -ENODEV;
 
-	if (np)
+	if (np) {

drivers/tty/serial/vt8500_serial.c static int vt8500_serial_probe(struct platform_device *pdev) · line 579

Quoted 10 lines
drivers/tty/serial/vt8500_serial.c +2 -1
 		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 */

Correct. This patch is good but unnecessary now as the patch series I pushed out removes this code anyway.

It should be applied if the series I sent out is not accepted in this merge windows.

Regards
Tony P