2017-12-06 21:10:24

by SF Markus Elfring

[permalink] [raw]
Subject: [PATCH 0/3] tty/serial/ucc_uart: Adjustments for two functions

From: Markus Elfring <[email protected]>
Date: Wed, 6 Dec 2017 22:06:44 +0100

Three update suggestions were taken into account
from static source code analysis.

Markus Elfring (3):
Delete an error message for a failed memory allocation in ucc_uart_probe()
Improve a size determination in ucc_uart_probe()
Fix a typo in a comment line

drivers/tty/serial/ucc_uart.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)

--
2.15.1


2017-12-06 21:12:04

by SF Markus Elfring

[permalink] [raw]
Subject: [PATCH 1/3] tty/serial/ucc_uart: Delete an error message for a failed memory allocation in ucc_uart_probe()

From: Markus Elfring <[email protected]>
Date: Wed, 6 Dec 2017 21:41:14 +0100

Omit an extra message for a memory allocation failure in this function.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <[email protected]>
---
drivers/tty/serial/ucc_uart.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/tty/serial/ucc_uart.c b/drivers/tty/serial/ucc_uart.c
index 2b6376e6e5ad..48364f0eba72 100644
--- a/drivers/tty/serial/ucc_uart.c
+++ b/drivers/tty/serial/ucc_uart.c
@@ -1254,10 +1254,8 @@ static int ucc_uart_probe(struct platform_device *ofdev)
}

qe_port = kzalloc(sizeof(struct uart_qe_port), GFP_KERNEL);
- if (!qe_port) {
- dev_err(&ofdev->dev, "can't allocate QE port structure\n");
+ if (!qe_port)
return -ENOMEM;
- }

/* Search for IRQ and mapbase */
ret = of_address_to_resource(np, 0, &res);
--
2.15.1

2017-12-06 21:14:02

by SF Markus Elfring

[permalink] [raw]
Subject: [PATCH 2/3] tty/serial/ucc_uart: Improve a size determination in ucc_uart_probe()

From: Markus Elfring <[email protected]>
Date: Wed, 6 Dec 2017 21:45:32 +0100

Replace the specification of a data structure by a pointer dereference
as the parameter for the operator "sizeof" to make the corresponding size
determination a bit safer according to the Linux coding style convention.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <[email protected]>
---
drivers/tty/serial/ucc_uart.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/tty/serial/ucc_uart.c b/drivers/tty/serial/ucc_uart.c
index 48364f0eba72..a9ce652899aa 100644
--- a/drivers/tty/serial/ucc_uart.c
+++ b/drivers/tty/serial/ucc_uart.c
@@ -1253,7 +1253,7 @@ static int ucc_uart_probe(struct platform_device *ofdev)
}
}

- qe_port = kzalloc(sizeof(struct uart_qe_port), GFP_KERNEL);
+ qe_port = kzalloc(sizeof(*qe_port), GFP_KERNEL);
if (!qe_port)
return -ENOMEM;

--
2.15.1

2017-12-06 21:15:57

by SF Markus Elfring

[permalink] [raw]
Subject: [PATCH 3/3] tty/serial/ucc_uart: Fix a typo in a comment line

From: Markus Elfring <[email protected]>
Date: Wed, 6 Dec 2017 21:56:28 +0100

Add a missing character in a function name of this description.

Signed-off-by: Markus Elfring <[email protected]>
---
drivers/tty/serial/ucc_uart.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/tty/serial/ucc_uart.c b/drivers/tty/serial/ucc_uart.c
index a9ce652899aa..d0f139d897a2 100644
--- a/drivers/tty/serial/ucc_uart.c
+++ b/drivers/tty/serial/ucc_uart.c
@@ -1154,7 +1154,7 @@ static unsigned int soc_info(unsigned int *rev_h, unsigned int *rev_l)
}

/*
- * requst_firmware_nowait() callback function
+ * request_firmware_nowait() callback function
*
* This function is called by the kernel when a firmware is made available,
* or if it times out waiting for the firmware.
--
2.15.1

2017-12-06 22:22:22

by Timur Tabi

[permalink] [raw]
Subject: Re: [PATCH 0/3] tty/serial/ucc_uart: Adjustments for two functions

On 12/06/2017 03:10 PM, SF Markus Elfring wrote:
>
> Three update suggestions were taken into account
> from static source code analysis.
>
> Markus Elfring (3):
> Delete an error message for a failed memory allocation in ucc_uart_probe()
> Improve a size determination in ucc_uart_probe()
> Fix a typo in a comment line

All three:

Acked-by: Timur Tabi <[email protected]>