* [PATCH 0/3] tty/serial/ioc3: Adjustments for three function implementations
@ 2017-12-09 18:02 SF Markus Elfring
2017-12-09 18:03 ` [PATCH 1/3] serial: ioc3: Delete error messages for a failed memory allocation in ioc3uart_probe() SF Markus Elfring
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: SF Markus Elfring @ 2017-12-09 18:02 UTC (permalink / raw)
To: linux-serial, linux-ia64, Greg Kroah-Hartman, Jiri Slaby, Pat Gefre
Cc: LKML, kernel-janitors
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sat, 9 Dec 2017 19:00:19 +0100
Three update suggestions were taken into account
from static source code analysis.
Markus Elfring (3):
Delete error messages for a failed memory allocation in ioc3uart_probe()
Improve size determinations in ioc3uart_probe()
Adjust two function calls together with a variable assignment
drivers/tty/serial/ioc3_serial.c | 22 +++++++++-------------
1 file changed, 9 insertions(+), 13 deletions(-)
--
2.15.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 1/3] serial: ioc3: Delete error messages for a failed memory allocation in ioc3uart_probe()
2017-12-09 18:02 [PATCH 0/3] tty/serial/ioc3: Adjustments for three function implementations SF Markus Elfring
@ 2017-12-09 18:03 ` SF Markus Elfring
2017-12-09 18:05 ` [PATCH 2/3] serial: ioc3: Improve size determinations " SF Markus Elfring
2017-12-09 18:06 ` [PATCH 3/3] serial: ioc3: Adjust two function calls together with a variable assignment SF Markus Elfring
2 siblings, 0 replies; 4+ messages in thread
From: SF Markus Elfring @ 2017-12-09 18:03 UTC (permalink / raw)
To: linux-serial, linux-ia64, Greg Kroah-Hartman, Jiri Slaby, Pat Gefre
Cc: LKML, kernel-janitors
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sat, 9 Dec 2017 18:34:36 +0100
Omit extra messages for a memory allocation failure in this function.
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/tty/serial/ioc3_serial.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/drivers/tty/serial/ioc3_serial.c b/drivers/tty/serial/ioc3_serial.c
index d8a1cdd6a53d..0007c2d65028 100644
--- a/drivers/tty/serial/ioc3_serial.c
+++ b/drivers/tty/serial/ioc3_serial.c
@@ -2017,11 +2017,9 @@ ioc3uart_probe(struct ioc3_submodule *is, struct ioc3_driver_data *idd)
DPRINT_CONFIG(("%s (0x%p, 0x%p)\n", __func__, is, idd));
card_ptr = kzalloc(sizeof(struct ioc3_card), GFP_KERNEL);
- if (!card_ptr) {
- printk(KERN_WARNING "ioc3_attach_one"
- ": unable to get memory for the IOC3\n");
+ if (!card_ptr)
return -ENOMEM;
- }
+
idd->data[is->id] = card_ptr;
Submodule_slot = is->id;
@@ -2038,8 +2036,6 @@ ioc3uart_probe(struct ioc3_submodule *is, struct ioc3_driver_data *idd)
for (phys_port = 0; phys_port < PORTS_PER_CARD; phys_port++) {
port = kzalloc(sizeof(struct ioc3_port), GFP_KERNEL);
if (!port) {
- printk(KERN_WARNING
- "IOC3 serial memory not available for port\n");
ret = -ENOMEM;
goto out4;
}
--
2.15.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/3] serial: ioc3: Improve size determinations in ioc3uart_probe()
2017-12-09 18:02 [PATCH 0/3] tty/serial/ioc3: Adjustments for three function implementations SF Markus Elfring
2017-12-09 18:03 ` [PATCH 1/3] serial: ioc3: Delete error messages for a failed memory allocation in ioc3uart_probe() SF Markus Elfring
@ 2017-12-09 18:05 ` SF Markus Elfring
2017-12-09 18:06 ` [PATCH 3/3] serial: ioc3: Adjust two function calls together with a variable assignment SF Markus Elfring
2 siblings, 0 replies; 4+ messages in thread
From: SF Markus Elfring @ 2017-12-09 18:05 UTC (permalink / raw)
To: linux-serial, linux-ia64, Greg Kroah-Hartman, Jiri Slaby, Pat Gefre
Cc: LKML, kernel-janitors
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sat, 9 Dec 2017 18:38:13 +0100
Replace the specification of two data structures by pointer dereferences
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 <elfring@users.sourceforge.net>
---
drivers/tty/serial/ioc3_serial.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/tty/serial/ioc3_serial.c b/drivers/tty/serial/ioc3_serial.c
index 0007c2d65028..d211bb1407d3 100644
--- a/drivers/tty/serial/ioc3_serial.c
+++ b/drivers/tty/serial/ioc3_serial.c
@@ -2016,7 +2016,7 @@ ioc3uart_probe(struct ioc3_submodule *is, struct ioc3_driver_data *idd)
DPRINT_CONFIG(("%s (0x%p, 0x%p)\n", __func__, is, idd));
- card_ptr = kzalloc(sizeof(struct ioc3_card), GFP_KERNEL);
+ card_ptr = kzalloc(sizeof(*card_ptr), GFP_KERNEL);
if (!card_ptr)
return -ENOMEM;
@@ -2034,7 +2034,7 @@ ioc3uart_probe(struct ioc3_submodule *is, struct ioc3_driver_data *idd)
/* Create port structures for each port */
for (phys_port = 0; phys_port < PORTS_PER_CARD; phys_port++) {
- port = kzalloc(sizeof(struct ioc3_port), GFP_KERNEL);
+ port = kzalloc(sizeof(*port), GFP_KERNEL);
if (!port) {
ret = -ENOMEM;
goto out4;
--
2.15.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 3/3] serial: ioc3: Adjust two function calls together with a variable assignment
2017-12-09 18:02 [PATCH 0/3] tty/serial/ioc3: Adjustments for three function implementations SF Markus Elfring
2017-12-09 18:03 ` [PATCH 1/3] serial: ioc3: Delete error messages for a failed memory allocation in ioc3uart_probe() SF Markus Elfring
2017-12-09 18:05 ` [PATCH 2/3] serial: ioc3: Improve size determinations " SF Markus Elfring
@ 2017-12-09 18:06 ` SF Markus Elfring
2 siblings, 0 replies; 4+ messages in thread
From: SF Markus Elfring @ 2017-12-09 18:06 UTC (permalink / raw)
To: linux-serial, linux-ia64, Greg Kroah-Hartman, Jiri Slaby, Pat Gefre
Cc: LKML, kernel-janitors
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sat, 9 Dec 2017 18:48:57 +0100
The script "checkpatch.pl" pointed information out like the following.
ERROR: do not use assignment in if condition
Thus fix the affected source code places.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/tty/serial/ioc3_serial.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/tty/serial/ioc3_serial.c b/drivers/tty/serial/ioc3_serial.c
index d211bb1407d3..0170d6f2bcdf 100644
--- a/drivers/tty/serial/ioc3_serial.c
+++ b/drivers/tty/serial/ioc3_serial.c
@@ -1540,8 +1540,8 @@ ioc3uart_intr_one(struct ioc3_submodule *is,
* hasn't been delivered to the cpu yet anyway, even
* though we see it as asserted when we read the sio_ir.
*/
- if ((sio_ir = PENDING(card_ptr, idd))
- & hooks->intr_rx_high) {
+ sio_ir = PENDING(card_ptr, idd);
+ if (sio_ir & hooks->intr_rx_high) {
if (port->ip_flags & READ_ABORTED) {
rx_high_rd_aborted++;
}
@@ -2162,10 +2162,10 @@ static struct ioc3_submodule ioc3uart_ops = {
*/
static int __init ioc3uart_init(void)
{
- int ret;
-
/* register with serial core */
- if ((ret = uart_register_driver(&ioc3_uart)) < 0) {
+ int ret = uart_register_driver(&ioc3_uart);
+
+ if (ret < 0) {
printk(KERN_WARNING
"%s: Couldn't register IOC3 uart serial driver\n",
__func__);
--
2.15.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-12-09 18:06 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-09 18:02 [PATCH 0/3] tty/serial/ioc3: Adjustments for three function implementations SF Markus Elfring
2017-12-09 18:03 ` [PATCH 1/3] serial: ioc3: Delete error messages for a failed memory allocation in ioc3uart_probe() SF Markus Elfring
2017-12-09 18:05 ` [PATCH 2/3] serial: ioc3: Improve size determinations " SF Markus Elfring
2017-12-09 18:06 ` [PATCH 3/3] serial: ioc3: Adjust two function calls together with a variable assignment SF Markus Elfring
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).