* [PATCH 1/4] serial: pch_uart: Delete an error message for a failed memory allocation in dma_handle_tx()
2017-12-08 18:08 [PATCH 0/4] tty/serial/pch_uart: Adjustments for four function implementations SF Markus Elfring
@ 2017-12-08 18:09 ` SF Markus Elfring
2017-12-08 18:10 ` [PATCH 2/4] serial: pch_uart: Use kcalloc() " SF Markus Elfring
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: SF Markus Elfring @ 2017-12-08 18:09 UTC (permalink / raw)
To: linux-serial, Greg Kroah-Hartman, Jiri Slaby; +Cc: LKML, kernel-janitors
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Fri, 8 Dec 2017 18:28:20 +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 <elfring@users.sourceforge.net>
---
drivers/tty/serial/pch_uart.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/tty/serial/pch_uart.c b/drivers/tty/serial/pch_uart.c
index 760d5dd0aada..0fc72c491c9b 100644
--- a/drivers/tty/serial/pch_uart.c
+++ b/drivers/tty/serial/pch_uart.c
@@ -992,10 +992,8 @@ static unsigned int dma_handle_tx(struct eg20t_port *priv)
priv->tx_dma_use = 1;
priv->sg_tx_p = kzalloc(sizeof(struct scatterlist)*num, GFP_ATOMIC);
- if (!priv->sg_tx_p) {
- dev_err(priv->port.dev, "%s:kzalloc Failed\n", __func__);
+ if (!priv->sg_tx_p)
return 0;
- }
sg_init_table(priv->sg_tx_p, num); /* Initialize SG table */
sg = priv->sg_tx_p;
--
2.15.1
^ permalink raw reply related [flat|nested] 5+ messages in thread* [PATCH 2/4] serial: pch_uart: Use kcalloc() in dma_handle_tx()
2017-12-08 18:08 [PATCH 0/4] tty/serial/pch_uart: Adjustments for four function implementations SF Markus Elfring
2017-12-08 18:09 ` [PATCH 1/4] serial: pch_uart: Delete an error message for a failed memory allocation in dma_handle_tx() SF Markus Elfring
@ 2017-12-08 18:10 ` SF Markus Elfring
2017-12-08 18:11 ` [PATCH 3/4] serial: pch_uart: Delete an unnecessary return statement in two functions SF Markus Elfring
2017-12-08 18:12 ` [PATCH 4/4] serial: pch_uart: Improve a size determination in pch_uart_init_port() SF Markus Elfring
3 siblings, 0 replies; 5+ messages in thread
From: SF Markus Elfring @ 2017-12-08 18:10 UTC (permalink / raw)
To: linux-serial, Greg Kroah-Hartman, Jiri Slaby; +Cc: LKML, kernel-janitors
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Fri, 8 Dec 2017 18:38:15 +0100
* A multiplication for the size determination of a memory allocation
indicated that an array data structure should be processed.
Thus use the corresponding function "kcalloc".
This issue was detected by using the Coccinelle software.
* Replace the specification of a data structure by a pointer dereference
to make the corresponding size determination a bit safer according to
the Linux coding style convention.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/tty/serial/pch_uart.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/tty/serial/pch_uart.c b/drivers/tty/serial/pch_uart.c
index 0fc72c491c9b..53cdf23b83c6 100644
--- a/drivers/tty/serial/pch_uart.c
+++ b/drivers/tty/serial/pch_uart.c
@@ -991,7 +991,7 @@ static unsigned int dma_handle_tx(struct eg20t_port *priv)
priv->tx_dma_use = 1;
- priv->sg_tx_p = kzalloc(sizeof(struct scatterlist)*num, GFP_ATOMIC);
+ priv->sg_tx_p = kcalloc(num, sizeof(*priv->sg_tx_p), GFP_ATOMIC);
if (!priv->sg_tx_p)
return 0;
--
2.15.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 3/4] serial: pch_uart: Delete an unnecessary return statement in two functions
2017-12-08 18:08 [PATCH 0/4] tty/serial/pch_uart: Adjustments for four function implementations SF Markus Elfring
2017-12-08 18:09 ` [PATCH 1/4] serial: pch_uart: Delete an error message for a failed memory allocation in dma_handle_tx() SF Markus Elfring
2017-12-08 18:10 ` [PATCH 2/4] serial: pch_uart: Use kcalloc() " SF Markus Elfring
@ 2017-12-08 18:11 ` SF Markus Elfring
2017-12-08 18:12 ` [PATCH 4/4] serial: pch_uart: Improve a size determination in pch_uart_init_port() SF Markus Elfring
3 siblings, 0 replies; 5+ messages in thread
From: SF Markus Elfring @ 2017-12-08 18:11 UTC (permalink / raw)
To: linux-serial, Greg Kroah-Hartman, Jiri Slaby; +Cc: LKML, kernel-janitors
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Fri, 8 Dec 2017 18:48:10 +0100
The script "checkpatch.pl" pointed information out like the following.
WARNING: void function return statements are not generally useful
Thus remove such a statement in the affected functions.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/tty/serial/pch_uart.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/tty/serial/pch_uart.c b/drivers/tty/serial/pch_uart.c
index 53cdf23b83c6..790a7aae331f 100644
--- a/drivers/tty/serial/pch_uart.c
+++ b/drivers/tty/serial/pch_uart.c
@@ -693,8 +693,6 @@ static void pch_free_dma(struct uart_port *port)
priv->rx_buf_virt = NULL;
priv->rx_buf_dma = 0;
}
-
- return;
}
static bool filter(struct dma_chan *chan, void *slave)
@@ -1861,8 +1859,8 @@ static void pch_uart_pci_remove(struct pci_dev *pdev)
pch_uart_exit_port(priv);
pci_disable_device(pdev);
kfree(priv);
- return;
}
+
#ifdef CONFIG_PM
static int pch_uart_pci_suspend(struct pci_dev *pdev, pm_message_t state)
{
--
2.15.1
^ permalink raw reply related [flat|nested] 5+ messages in thread* [PATCH 4/4] serial: pch_uart: Improve a size determination in pch_uart_init_port()
2017-12-08 18:08 [PATCH 0/4] tty/serial/pch_uart: Adjustments for four function implementations SF Markus Elfring
` (2 preceding siblings ...)
2017-12-08 18:11 ` [PATCH 3/4] serial: pch_uart: Delete an unnecessary return statement in two functions SF Markus Elfring
@ 2017-12-08 18:12 ` SF Markus Elfring
3 siblings, 0 replies; 5+ messages in thread
From: SF Markus Elfring @ 2017-12-08 18:12 UTC (permalink / raw)
To: linux-serial, Greg Kroah-Hartman, Jiri Slaby; +Cc: LKML, kernel-janitors
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Fri, 8 Dec 2017 18:53:21 +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 <elfring@users.sourceforge.net>
---
drivers/tty/serial/pch_uart.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/tty/serial/pch_uart.c b/drivers/tty/serial/pch_uart.c
index 790a7aae331f..1c30309ef02c 100644
--- a/drivers/tty/serial/pch_uart.c
+++ b/drivers/tty/serial/pch_uart.c
@@ -1747,7 +1747,7 @@ static struct eg20t_port *pch_uart_init_port(struct pci_dev *pdev,
board = &drv_dat[id->driver_data];
port_type = board->port_type;
- priv = kzalloc(sizeof(struct eg20t_port), GFP_KERNEL);
+ priv = kzalloc(sizeof(*priv), GFP_KERNEL);
if (priv == NULL)
goto init_port_alloc_err;
--
2.15.1
^ permalink raw reply related [flat|nested] 5+ messages in thread