* [PATCH 0/3] tty/serial/ifx6x60: Adjustments for five function implementations
@ 2017-12-09 19:10 ` SF Markus Elfring
0 siblings, 0 replies; 8+ messages in thread
From: SF Markus Elfring @ 2017-12-09 19:10 UTC (permalink / raw)
To: linux-serial, Greg Kroah-Hartman, Jiri Slaby; +Cc: LKML, kernel-janitors
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sat, 9 Dec 2017 20:03:45 +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 ifx_spi_spi_probe()
Improve a size determination in ifx_spi_spi_probe()
Add some spaces for better code readability
drivers/tty/serial/ifx6x60.c | 21 ++++++++++-----------
1 file changed, 10 insertions(+), 11 deletions(-)
--
2.15.1
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 0/3] tty/serial/ifx6x60: Adjustments for five function implementations
@ 2017-12-09 19:10 ` SF Markus Elfring
0 siblings, 0 replies; 8+ messages in thread
From: SF Markus Elfring @ 2017-12-09 19:10 UTC (permalink / raw)
To: linux-serial, Greg Kroah-Hartman, Jiri Slaby; +Cc: LKML, kernel-janitors
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sat, 9 Dec 2017 20:03:45 +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 ifx_spi_spi_probe()
Improve a size determination in ifx_spi_spi_probe()
Add some spaces for better code readability
drivers/tty/serial/ifx6x60.c | 21 ++++++++++-----------
1 file changed, 10 insertions(+), 11 deletions(-)
--
2.15.1
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 1/3] serial: ifx6x60: Delete an error message for a failed memory allocation in ifx_spi_spi_probe()
2017-12-09 19:10 ` SF Markus Elfring
@ 2017-12-09 19:11 ` SF Markus Elfring
-1 siblings, 0 replies; 8+ messages in thread
From: SF Markus Elfring @ 2017-12-09 19:11 UTC (permalink / raw)
To: linux-serial, Greg Kroah-Hartman, Jiri Slaby; +Cc: LKML, kernel-janitors
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sat, 9 Dec 2017 19:20:37 +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/ifx6x60.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/tty/serial/ifx6x60.c b/drivers/tty/serial/ifx6x60.c
index 473f4f81d690..832751479f41 100644
--- a/drivers/tty/serial/ifx6x60.c
+++ b/drivers/tty/serial/ifx6x60.c
@@ -1006,10 +1006,9 @@ static int ifx_spi_spi_probe(struct spi_device *spi)
/* initialize structure to hold our device variables */
ifx_dev = kzalloc(sizeof(struct ifx_spi_device), GFP_KERNEL);
- if (!ifx_dev) {
- dev_err(&spi->dev, "spi device allocation failed");
+ if (!ifx_dev)
return -ENOMEM;
- }
+
saved_ifx_dev = ifx_dev;
ifx_dev->spi_dev = spi;
clear_bit(IFX_SPI_STATE_IO_IN_PROGRESS, &ifx_dev->flags);
--
2.15.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 1/3] serial: ifx6x60: Delete an error message for a failed memory allocation in ifx_spi_spi_p
@ 2017-12-09 19:11 ` SF Markus Elfring
0 siblings, 0 replies; 8+ messages in thread
From: SF Markus Elfring @ 2017-12-09 19:11 UTC (permalink / raw)
To: linux-serial, Greg Kroah-Hartman, Jiri Slaby; +Cc: LKML, kernel-janitors
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sat, 9 Dec 2017 19:20:37 +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/ifx6x60.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/tty/serial/ifx6x60.c b/drivers/tty/serial/ifx6x60.c
index 473f4f81d690..832751479f41 100644
--- a/drivers/tty/serial/ifx6x60.c
+++ b/drivers/tty/serial/ifx6x60.c
@@ -1006,10 +1006,9 @@ static int ifx_spi_spi_probe(struct spi_device *spi)
/* initialize structure to hold our device variables */
ifx_dev = kzalloc(sizeof(struct ifx_spi_device), GFP_KERNEL);
- if (!ifx_dev) {
- dev_err(&spi->dev, "spi device allocation failed");
+ if (!ifx_dev)
return -ENOMEM;
- }
+
saved_ifx_dev = ifx_dev;
ifx_dev->spi_dev = spi;
clear_bit(IFX_SPI_STATE_IO_IN_PROGRESS, &ifx_dev->flags);
--
2.15.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 2/3] serial: ifx6x60: Improve a size determination in ifx_spi_spi_probe()
2017-12-09 19:10 ` SF Markus Elfring
@ 2017-12-09 19:12 ` SF Markus Elfring
-1 siblings, 0 replies; 8+ messages in thread
From: SF Markus Elfring @ 2017-12-09 19:12 UTC (permalink / raw)
To: linux-serial, Greg Kroah-Hartman, Jiri Slaby; +Cc: LKML, kernel-janitors
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sat, 9 Dec 2017 19:22:50 +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/ifx6x60.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/tty/serial/ifx6x60.c b/drivers/tty/serial/ifx6x60.c
index 832751479f41..1883e3382338 100644
--- a/drivers/tty/serial/ifx6x60.c
+++ b/drivers/tty/serial/ifx6x60.c
@@ -1005,7 +1005,7 @@ static int ifx_spi_spi_probe(struct spi_device *spi)
}
/* initialize structure to hold our device variables */
- ifx_dev = kzalloc(sizeof(struct ifx_spi_device), GFP_KERNEL);
+ ifx_dev = kzalloc(sizeof(*ifx_dev), GFP_KERNEL);
if (!ifx_dev)
return -ENOMEM;
--
2.15.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 2/3] serial: ifx6x60: Improve a size determination in ifx_spi_spi_probe()
@ 2017-12-09 19:12 ` SF Markus Elfring
0 siblings, 0 replies; 8+ messages in thread
From: SF Markus Elfring @ 2017-12-09 19:12 UTC (permalink / raw)
To: linux-serial, Greg Kroah-Hartman, Jiri Slaby; +Cc: LKML, kernel-janitors
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sat, 9 Dec 2017 19:22:50 +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/ifx6x60.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/tty/serial/ifx6x60.c b/drivers/tty/serial/ifx6x60.c
index 832751479f41..1883e3382338 100644
--- a/drivers/tty/serial/ifx6x60.c
+++ b/drivers/tty/serial/ifx6x60.c
@@ -1005,7 +1005,7 @@ static int ifx_spi_spi_probe(struct spi_device *spi)
}
/* initialize structure to hold our device variables */
- ifx_dev = kzalloc(sizeof(struct ifx_spi_device), GFP_KERNEL);
+ ifx_dev = kzalloc(sizeof(*ifx_dev), GFP_KERNEL);
if (!ifx_dev)
return -ENOMEM;
--
2.15.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 3/3] serial: ifx6x60: Add some spaces for better code readability
2017-12-09 19:10 ` SF Markus Elfring
@ 2017-12-09 19:13 ` SF Markus Elfring
-1 siblings, 0 replies; 8+ messages in thread
From: SF Markus Elfring @ 2017-12-09 19:13 UTC (permalink / raw)
To: linux-serial, Greg Kroah-Hartman, Jiri Slaby; +Cc: LKML, kernel-janitors
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sat, 9 Dec 2017 19:55:31 +0100
Use space characters at some source code places according to
the Linux coding style convention.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/tty/serial/ifx6x60.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/drivers/tty/serial/ifx6x60.c b/drivers/tty/serial/ifx6x60.c
index 1883e3382338..f40f64378406 100644
--- a/drivers/tty/serial/ifx6x60.c
+++ b/drivers/tty/serial/ifx6x60.c
@@ -248,8 +248,8 @@ static void mrdy_assert(struct ifx_spi_device *ifx_dev)
if (!val) {
if (!test_and_set_bit(IFX_SPI_STATE_TIMER_PENDING,
&ifx_dev->flags)) {
- mod_timer(&ifx_dev->spi_timer,jiffies + IFX_SPI_TIMEOUT_SEC*HZ);
-
+ mod_timer(&ifx_dev->spi_timer,
+ jiffies + IFX_SPI_TIMEOUT_SEC * HZ);
}
}
ifx_spi_power_state_set(ifx_dev, IFX_SPI_POWER_DATA_PENDING);
@@ -378,7 +378,7 @@ static int ifx_spi_decode_spi_header(unsigned char *buffer, int *length,
u16 *in_buffer = (u16 *)buffer;
h1 = *in_buffer;
- h2 = *(in_buffer+1);
+ h2 = *(in_buffer + 1);
if (h1 == 0 && h2 == 0) {
*received_cts = 0;
@@ -410,7 +410,7 @@ static void ifx_spi_setup_spi_header(unsigned char *txbuffer, int tx_count,
unsigned char more)
{
*(u16 *)(txbuffer) = tx_count;
- *(u16 *)(txbuffer+2) = IFX_SPI_PAYLOAD_SIZE;
+ *(u16 *)(txbuffer + 2) = IFX_SPI_PAYLOAD_SIZE;
txbuffer[1] |= (more << IFX_SPI_MORE_BIT) & IFX_SPI_MORE_MASK;
}
@@ -467,8 +467,8 @@ static int ifx_spi_prepare_tx_buffer(struct ifx_spi_device *ifx_dev)
/* have data and info for header -- set up SPI header in buffer */
/* spi header needs payload size, not entire buffer size */
ifx_spi_setup_spi_header(ifx_dev->tx_buffer,
- tx_count-IFX_SPI_HEADER_OVERHEAD,
- ifx_dev->spi_more);
+ tx_count - IFX_SPI_HEADER_OVERHEAD,
+ ifx_dev->spi_more);
/* swap actual data in the buffer */
ifx_dev->swap_buf((ifx_dev->tx_buffer), tx_count,
&ifx_dev->tx_buffer[IFX_SPI_TRANSFER_SIZE]);
@@ -1163,7 +1163,7 @@ static int ifx_spi_spi_probe(struct spi_device *spi)
ret = request_irq(gpio_to_irq(ifx_dev->gpio.reset_out),
ifx_spi_reset_interrupt,
- IRQF_TRIGGER_RISING|IRQF_TRIGGER_FALLING, DRVNAME,
+ IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, DRVNAME,
ifx_dev);
if (ret) {
dev_err(&spi->dev, "Unable to get irq %x\n",
--
2.15.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 3/3] serial: ifx6x60: Add some spaces for better code readability
@ 2017-12-09 19:13 ` SF Markus Elfring
0 siblings, 0 replies; 8+ messages in thread
From: SF Markus Elfring @ 2017-12-09 19:13 UTC (permalink / raw)
To: linux-serial, Greg Kroah-Hartman, Jiri Slaby; +Cc: LKML, kernel-janitors
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sat, 9 Dec 2017 19:55:31 +0100
Use space characters at some source code places according to
the Linux coding style convention.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/tty/serial/ifx6x60.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/drivers/tty/serial/ifx6x60.c b/drivers/tty/serial/ifx6x60.c
index 1883e3382338..f40f64378406 100644
--- a/drivers/tty/serial/ifx6x60.c
+++ b/drivers/tty/serial/ifx6x60.c
@@ -248,8 +248,8 @@ static void mrdy_assert(struct ifx_spi_device *ifx_dev)
if (!val) {
if (!test_and_set_bit(IFX_SPI_STATE_TIMER_PENDING,
&ifx_dev->flags)) {
- mod_timer(&ifx_dev->spi_timer,jiffies + IFX_SPI_TIMEOUT_SEC*HZ);
-
+ mod_timer(&ifx_dev->spi_timer,
+ jiffies + IFX_SPI_TIMEOUT_SEC * HZ);
}
}
ifx_spi_power_state_set(ifx_dev, IFX_SPI_POWER_DATA_PENDING);
@@ -378,7 +378,7 @@ static int ifx_spi_decode_spi_header(unsigned char *buffer, int *length,
u16 *in_buffer = (u16 *)buffer;
h1 = *in_buffer;
- h2 = *(in_buffer+1);
+ h2 = *(in_buffer + 1);
if (h1 = 0 && h2 = 0) {
*received_cts = 0;
@@ -410,7 +410,7 @@ static void ifx_spi_setup_spi_header(unsigned char *txbuffer, int tx_count,
unsigned char more)
{
*(u16 *)(txbuffer) = tx_count;
- *(u16 *)(txbuffer+2) = IFX_SPI_PAYLOAD_SIZE;
+ *(u16 *)(txbuffer + 2) = IFX_SPI_PAYLOAD_SIZE;
txbuffer[1] |= (more << IFX_SPI_MORE_BIT) & IFX_SPI_MORE_MASK;
}
@@ -467,8 +467,8 @@ static int ifx_spi_prepare_tx_buffer(struct ifx_spi_device *ifx_dev)
/* have data and info for header -- set up SPI header in buffer */
/* spi header needs payload size, not entire buffer size */
ifx_spi_setup_spi_header(ifx_dev->tx_buffer,
- tx_count-IFX_SPI_HEADER_OVERHEAD,
- ifx_dev->spi_more);
+ tx_count - IFX_SPI_HEADER_OVERHEAD,
+ ifx_dev->spi_more);
/* swap actual data in the buffer */
ifx_dev->swap_buf((ifx_dev->tx_buffer), tx_count,
&ifx_dev->tx_buffer[IFX_SPI_TRANSFER_SIZE]);
@@ -1163,7 +1163,7 @@ static int ifx_spi_spi_probe(struct spi_device *spi)
ret = request_irq(gpio_to_irq(ifx_dev->gpio.reset_out),
ifx_spi_reset_interrupt,
- IRQF_TRIGGER_RISING|IRQF_TRIGGER_FALLING, DRVNAME,
+ IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, DRVNAME,
ifx_dev);
if (ret) {
dev_err(&spi->dev, "Unable to get irq %x\n",
--
2.15.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
end of thread, other threads:[~2017-12-09 19:13 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-09 19:10 [PATCH 0/3] tty/serial/ifx6x60: Adjustments for five function implementations SF Markus Elfring
2017-12-09 19:10 ` SF Markus Elfring
2017-12-09 19:11 ` [PATCH 1/3] serial: ifx6x60: Delete an error message for a failed memory allocation in ifx_spi_spi_probe() SF Markus Elfring
2017-12-09 19:11 ` [PATCH 1/3] serial: ifx6x60: Delete an error message for a failed memory allocation in ifx_spi_spi_p SF Markus Elfring
2017-12-09 19:12 ` [PATCH 2/3] serial: ifx6x60: Improve a size determination in ifx_spi_spi_probe() SF Markus Elfring
2017-12-09 19:12 ` SF Markus Elfring
2017-12-09 19:13 ` [PATCH 3/3] serial: ifx6x60: Add some spaces for better code readability SF Markus Elfring
2017-12-09 19:13 ` SF Markus Elfring
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.