* [PATCH] In absence of braces, port and NULL are missed
@ 2013-10-13 22:29 Roel Kluin
2013-10-14 12:54 ` Mark Rutland
0 siblings, 1 reply; 4+ messages in thread
From: Roel Kluin @ 2013-10-13 22:29 UTC (permalink / raw)
To: Grant Likely, Rob Herring, devicetree-u79uwXL29TY76Z2rM5mHXA; +Cc: Roel Kluin
Signed-off-by: Roel Kluin <roel.kluin-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
---
drivers/tty/serial/vt8500_serial.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
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 */
--
1.8.1.2
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH] In absence of braces, port and NULL are missed
2013-10-13 22:29 [PATCH] In absence of braces, port and NULL are missed Roel Kluin
@ 2013-10-14 12:54 ` Mark Rutland
2013-10-14 17:37 ` Tony Prisk
2013-10-14 21:21 ` Roel Kluin
0 siblings, 2 replies; 4+ messages in thread
From: Mark Rutland @ 2013-10-14 12:54 UTC (permalink / raw)
To: Roel Kluin
Cc: grant.likely@linaro.org, rob.herring@calxeda.com,
devicetree@vger.kernel.org, Tony Prisk, linux-serial
[Adding Tony Prisk and linux-serial]
Hi Roel,
While this looks like a good fix, the commit message is a bit confusing.
How about something like the message between the scissor lines below:
---->8----
[PATCH] serial: vt8500: add missing braces
Due to missing braces on an if statement, port will always be assigned
-1 regardless of any alias entries in the dt, which was clearly not the
intended behaviour.
This patch adds the missing braces, fixing the issue.
---->8----
Also, while this is device tree related, you should Cc the driver
maintainer when submitting driver changes.
Cheers,
Mark.
On Sun, Oct 13, 2013 at 11:29:36PM +0100, Roel Kluin wrote:
> Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
> ---
> drivers/tty/serial/vt8500_serial.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> 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 */
> --
> 1.8.1.2
>
> --
> To unsubscribe from this list: send the line "unsubscribe devicetree" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] In absence of braces, port and NULL are missed
2013-10-14 12:54 ` Mark Rutland
@ 2013-10-14 17:37 ` Tony Prisk
2013-10-14 21:21 ` Roel Kluin
1 sibling, 0 replies; 4+ messages in thread
From: Tony Prisk @ 2013-10-14 17:37 UTC (permalink / raw)
To: Mark Rutland, Roel Kluin
Cc: grant.likely@linaro.org, rob.herring@calxeda.com,
devicetree@vger.kernel.org, linux-serial
On 15/10/13 01:54, Mark Rutland wrote:
> [Adding Tony Prisk and linux-serial]
>
> Hi Roel,
>
> While this looks like a good fix, the commit message is a bit confusing.
> How about something like the message between the scissor lines below:
>
> ---->8----
> [PATCH] serial: vt8500: add missing braces
>
> Due to missing braces on an if statement, port will always be assigned
> -1 regardless of any alias entries in the dt, which was clearly not the
> intended behaviour.
>
> This patch adds the missing braces, fixing the issue.
> ---->8----
>
> Also, while this is device tree related, you should Cc the driver
> maintainer when submitting driver changes.
>
> Cheers,
> Mark.
>
> On Sun, Oct 13, 2013 at 11:29:36PM +0100, Roel Kluin wrote:
>> Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
>> ---
>> drivers/tty/serial/vt8500_serial.c | 5 +++--
>> 1 file changed, 3 insertions(+), 2 deletions(-)
>>
>> 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 */
>> --
>> 1.8.1.2
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe devicetree" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at http://vger.kernel.org/majordomo-info.html
>>
Nice find and thanks for the fix.
Acked-by: Tony Prisk <linux@prisktech.co.nz>
Regards
Tony P
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] In absence of braces, port and NULL are missed
2013-10-14 12:54 ` Mark Rutland
2013-10-14 17:37 ` Tony Prisk
@ 2013-10-14 21:21 ` Roel Kluin
1 sibling, 0 replies; 4+ messages in thread
From: Roel Kluin @ 2013-10-14 21:21 UTC (permalink / raw)
To: Mark Rutland
Cc: Roel Kluin, grant.likely@linaro.org, rob.herring@calxeda.com,
devicetree@vger.kernel.org, Tony Prisk, linux-serial
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@gmail.com>
Acked-by: Tony Prisk <linux@prisktech.co.nz>
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 */
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-10-14 21:21 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-13 22:29 [PATCH] In absence of braces, port and NULL are missed Roel Kluin
2013-10-14 12:54 ` Mark Rutland
2013-10-14 17:37 ` Tony Prisk
2013-10-14 21:21 ` Roel Kluin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).