Re: [PATCH] In absence of braces, port and NULL are missed

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Mark,

On Mon, 14 Oct 2013, Mark Rutland wrote:

> While this looks like a good fix, the commit message is a bit confusing.

I like your suggestion, however I feel the commit message fails to 
appreciate the error path this patch addresses as well, so I adapted your 
suggested commit message to the following:

---
[PATCH] serial: vt8500: add missing braces

    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@xxxxxxxxx>
    Acked-by: Tony Prisk <linux@xxxxxxxxxxxxxxx>

diff --git a/drivers/tty/serial/vt8500_serial.c 
b/drivers/tty/serial/vt8500_serial.c
index 93b697a..4cf71c0 100644
--- a/drivers/tty/serial/vt8500_serial.c
+++ b/drivers/tty/serial/vt8500_serial.c
@@ -561,12 +561,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 */

--
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




[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux PPP]     [Linux FS]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Linmodem]     [Device Mapper]     [Linux Kernel for ARM]

  Powered by Linux