linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/17] SPI: Fine-tuning for several function implementations
@ 2017-01-13 17:05 SF Markus Elfring
  2017-01-13 17:07 ` [PATCH 01/17] spi: Use kcalloc() in spi_register_board_info() SF Markus Elfring
                   ` (16 more replies)
  0 siblings, 17 replies; 41+ messages in thread
From: SF Markus Elfring @ 2017-01-13 17:05 UTC (permalink / raw)
  To: linux-spi, Mark Brown; +Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Fri, 13 Jan 2017 17:50:23 +0100

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

Markus Elfring (17):
  Use kcalloc() in spi_register_board_info()
  Adjust checks for null pointers in two functions
  fsl: Use kcalloc() in of_fsl_spi_get_chipselects()
  fsl: Use kmalloc_array() in of_fsl_spi_get_chipselects()
  fsl: Combine substrings for two messages
  mpc52xx: Use kmalloc_array() in mpc52xx_spi_probe()
  mpc52xx: Combine substrings for two messages
  ppc4xx: Use kcalloc() in spi_ppc4xx_of_probe()
  ppc4xx: Combine substrings for a message in spi_ppc4xx_of_probe()
  ppc4xx: Adjust checks for null pointers in two functions
  topcliff-pch: Use kcalloc() in pch_spi_handle_dma()
  topcliff-pch: Improve size determinations in pch_spi_probe()
  topcliff-pch: Delete an unnecessary return statement in two functions
  topcliff-pch: Adjust six checks for null pointers
  topcliff-pch: Combine substrings for four messages
  topcliff-pch: Delete an error message for a failed memory allocation in pch_spi_set_tx()
  topcliff-pch: One check less in pch_spi_set_tx()

 drivers/spi/spi-fsl-spi.c      | 17 +++++-----
 drivers/spi/spi-mpc52xx.c      | 12 +++----
 drivers/spi/spi-ppc4xx.c       | 15 ++++-----
 drivers/spi/spi-topcliff-pch.c | 71 +++++++++++++++++++++---------------------
 drivers/spi/spi.c              | 10 +++---
 5 files changed, 63 insertions(+), 62 deletions(-)

-- 
2.11.0

^ permalink raw reply	[flat|nested] 41+ messages in thread

* [PATCH 01/17] spi: Use kcalloc() in spi_register_board_info()
  2017-01-13 17:05 [PATCH 00/17] SPI: Fine-tuning for several function implementations SF Markus Elfring
@ 2017-01-13 17:07 ` SF Markus Elfring
  2017-01-17 18:46   ` Applied "spi: Use kcalloc() in spi_register_board_info()" to the spi tree Mark Brown
  2017-01-13 17:09 ` [PATCH 02/17] spi: Adjust checks for null pointers in two functions SF Markus Elfring
                   ` (15 subsequent siblings)
  16 siblings, 1 reply; 41+ messages in thread
From: SF Markus Elfring @ 2017-01-13 17:07 UTC (permalink / raw)
  To: linux-spi, Mark Brown; +Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Fri, 13 Jan 2017 12:28:04 +0100

A multiplication for the size determination of a memory allocation
indicated that an array data structure should be processed.
Thus reuse the corresponding function "kcalloc".

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/spi/spi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index 656dd3e3220c..8c05f27bf642 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -672,7 +672,7 @@ int spi_register_board_info(struct spi_board_info const *info, unsigned n)
 	if (!n)
 		return -EINVAL;
 
-	bi = kzalloc(n * sizeof(*bi), GFP_KERNEL);
+	bi = kcalloc(n, sizeof(*bi), GFP_KERNEL);
 	if (!bi)
 		return -ENOMEM;
 
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 41+ messages in thread

* [PATCH 02/17] spi: Adjust checks for null pointers in two functions
  2017-01-13 17:05 [PATCH 00/17] SPI: Fine-tuning for several function implementations SF Markus Elfring
  2017-01-13 17:07 ` [PATCH 01/17] spi: Use kcalloc() in spi_register_board_info() SF Markus Elfring
@ 2017-01-13 17:09 ` SF Markus Elfring
  2017-01-17 18:21   ` Mark Brown
  2017-01-13 17:11 ` [PATCH 03/17] spi: fsl: Use kcalloc() in of_fsl_spi_get_chipselects() SF Markus Elfring
                   ` (14 subsequent siblings)
  16 siblings, 1 reply; 41+ messages in thread
From: SF Markus Elfring @ 2017-01-13 17:09 UTC (permalink / raw)
  To: linux-spi, Mark Brown; +Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Fri, 13 Jan 2017 13:23:32 +0100
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

The script "checkpatch.pl" pointed information out like the following.

Comparison to NULL could be written !…

Thus fix the affected source code places.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/spi/spi.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index 8c05f27bf642..d8d273545e54 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -816,7 +816,7 @@ static int __spi_map_msg(struct spi_master *master, struct spi_message *msg)
 		if (!master->can_dma(master, msg->spi, xfer))
 			continue;
 
-		if (xfer->tx_buf != NULL) {
+		if (xfer->tx_buf) {
 			ret = spi_map_buf(master, tx_dev, &xfer->tx_sg,
 					  (void *)xfer->tx_buf, xfer->len,
 					  DMA_TO_DEVICE);
@@ -824,7 +824,7 @@ static int __spi_map_msg(struct spi_master *master, struct spi_message *msg)
 				return ret;
 		}
 
-		if (xfer->rx_buf != NULL) {
+		if (xfer->rx_buf) {
 			ret = spi_map_buf(master, rx_dev, &xfer->rx_sg,
 					  xfer->rx_buf, xfer->len,
 					  DMA_FROM_DEVICE);
@@ -3133,7 +3133,7 @@ static int of_spi_notify(struct notifier_block *nb, unsigned long action,
 	switch (of_reconfig_get_state_change(action, arg)) {
 	case OF_RECONFIG_CHANGE_ADD:
 		master = of_find_spi_master_by_node(rd->dn->parent);
-		if (master == NULL)
+		if (!master)
 			return NOTIFY_OK;	/* not for us */
 
 		if (of_node_test_and_set_flag(rd->dn, OF_POPULATED)) {
@@ -3159,7 +3159,7 @@ static int of_spi_notify(struct notifier_block *nb, unsigned long action,
 
 		/* find our device by node */
 		spi = of_find_spi_device_by_node(rd->dn);
-		if (spi == NULL)
+		if (!spi)
 			return NOTIFY_OK;	/* no? not meant for us */
 
 		/* unregister takes one ref away */
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 41+ messages in thread

* [PATCH 03/17] spi: fsl: Use kcalloc() in of_fsl_spi_get_chipselects()
  2017-01-13 17:05 [PATCH 00/17] SPI: Fine-tuning for several function implementations SF Markus Elfring
  2017-01-13 17:07 ` [PATCH 01/17] spi: Use kcalloc() in spi_register_board_info() SF Markus Elfring
  2017-01-13 17:09 ` [PATCH 02/17] spi: Adjust checks for null pointers in two functions SF Markus Elfring
@ 2017-01-13 17:11 ` SF Markus Elfring
  2017-01-17 18:46   ` Applied "spi: fsl: Use kcalloc() in of_fsl_spi_get_chipselects()" to the spi tree Mark Brown
  2017-01-13 17:12 ` [PATCH 04/17] spi: fsl: Use kmalloc_array() in of_fsl_spi_get_chipselects() SF Markus Elfring
                   ` (13 subsequent siblings)
  16 siblings, 1 reply; 41+ messages in thread
From: SF Markus Elfring @ 2017-01-13 17:11 UTC (permalink / raw)
  To: linux-spi, Mark Brown; +Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Fri, 13 Jan 2017 13:33:02 +0100

A multiplication for the size determination of a memory allocation
indicated that an array data structure should be processed.
Thus reuse the corresponding function "kcalloc".

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/spi/spi-fsl-spi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/spi/spi-fsl-spi.c b/drivers/spi/spi-fsl-spi.c
index 8b290d9d7935..d1b26c9fe950 100644
--- a/drivers/spi/spi-fsl-spi.c
+++ b/drivers/spi/spi-fsl-spi.c
@@ -732,7 +732,7 @@ static int of_fsl_spi_get_chipselects(struct device *dev)
 		return -ENOMEM;
 	memset(pinfo->gpios, -1, ngpios * sizeof(*pinfo->gpios));
 
-	pinfo->alow_flags = kzalloc(ngpios * sizeof(*pinfo->alow_flags),
+	pinfo->alow_flags = kcalloc(ngpios, sizeof(*pinfo->alow_flags),
 				    GFP_KERNEL);
 	if (!pinfo->alow_flags) {
 		ret = -ENOMEM;
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 41+ messages in thread

* [PATCH 04/17] spi: fsl: Use kmalloc_array() in of_fsl_spi_get_chipselects()
  2017-01-13 17:05 [PATCH 00/17] SPI: Fine-tuning for several function implementations SF Markus Elfring
                   ` (2 preceding siblings ...)
  2017-01-13 17:11 ` [PATCH 03/17] spi: fsl: Use kcalloc() in of_fsl_spi_get_chipselects() SF Markus Elfring
@ 2017-01-13 17:12 ` SF Markus Elfring
  2017-01-17 18:27   ` Mark Brown
  2017-01-17 18:46   ` Applied "spi: fsl: Use kmalloc_array() in of_fsl_spi_get_chipselects()" to the spi tree Mark Brown
  2017-01-13 17:13 ` [PATCH 05/17] spi: fsl: Combine substrings for two messages SF Markus Elfring
                   ` (12 subsequent siblings)
  16 siblings, 2 replies; 41+ messages in thread
From: SF Markus Elfring @ 2017-01-13 17:12 UTC (permalink / raw)
  To: linux-spi, Mark Brown; +Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Fri, 13 Jan 2017 13:37:25 +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 "kmalloc_array".

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/spi/spi-fsl-spi.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/spi/spi-fsl-spi.c b/drivers/spi/spi-fsl-spi.c
index d1b26c9fe950..cdee556037f9 100644
--- a/drivers/spi/spi-fsl-spi.c
+++ b/drivers/spi/spi-fsl-spi.c
@@ -727,7 +727,8 @@ static int of_fsl_spi_get_chipselects(struct device *dev)
 		return 0;
 	}
 
-	pinfo->gpios = kmalloc(ngpios * sizeof(*pinfo->gpios), GFP_KERNEL);
+	pinfo->gpios = kmalloc_array(ngpios, sizeof(*pinfo->gpios),
+				     GFP_KERNEL);
 	if (!pinfo->gpios)
 		return -ENOMEM;
 	memset(pinfo->gpios, -1, ngpios * sizeof(*pinfo->gpios));
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 41+ messages in thread

* [PATCH 05/17] spi: fsl: Combine substrings for two messages
  2017-01-13 17:05 [PATCH 00/17] SPI: Fine-tuning for several function implementations SF Markus Elfring
                   ` (3 preceding siblings ...)
  2017-01-13 17:12 ` [PATCH 04/17] spi: fsl: Use kmalloc_array() in of_fsl_spi_get_chipselects() SF Markus Elfring
@ 2017-01-13 17:13 ` SF Markus Elfring
  2017-01-17 18:46   ` Applied "spi: fsl: Combine substrings for two messages" to the spi tree Mark Brown
  2017-01-13 17:14 ` [PATCH 06/17] spi/mpc52xx: Use kmalloc_array() in mpc52xx_spi_probe() SF Markus Elfring
                   ` (11 subsequent siblings)
  16 siblings, 1 reply; 41+ messages in thread
From: SF Markus Elfring @ 2017-01-13 17:13 UTC (permalink / raw)
  To: linux-spi, Mark Brown; +Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Fri, 13 Jan 2017 13:50:21 +0100

The script "checkpatch.pl" pointed information out like the following.

WARNING: quoted string split across lines

Thus fix the affected source code places.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/spi/spi-fsl-spi.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/spi/spi-fsl-spi.c b/drivers/spi/spi-fsl-spi.c
index cdee556037f9..0fc3452652ae 100644
--- a/drivers/spi/spi-fsl-spi.c
+++ b/drivers/spi/spi-fsl-spi.c
@@ -267,10 +267,9 @@ static int fsl_spi_setup_transfer(struct spi_device *spi,
 	if ((mpc8xxx_spi->spibrg / hz) > 64) {
 		cs->hw_mode |= SPMODE_DIV16;
 		pm = (mpc8xxx_spi->spibrg - 1) / (hz * 64) + 1;
-
-		WARN_ONCE(pm > 16, "%s: Requested speed is too low: %d Hz. "
-			  "Will use %d Hz instead.\n", dev_name(&spi->dev),
-			  hz, mpc8xxx_spi->spibrg / 1024);
+		WARN_ONCE(pm > 16,
+			  "%s: Requested speed is too low: %d Hz. Will use %d Hz instead.\n",
+			  dev_name(&spi->dev), hz, mpc8xxx_spi->spibrg / 1024);
 		if (pm > 16)
 			pm = 16;
 	} else {
@@ -763,8 +762,9 @@ static int of_fsl_spi_get_chipselects(struct device *dev)
 		ret = gpio_direction_output(pinfo->gpios[i],
 					    pinfo->alow_flags[i]);
 		if (ret) {
-			dev_err(dev, "can't set output direction for gpio "
-				"#%d: %d\n", i, ret);
+			dev_err(dev,
+				"can't set output direction for gpio #%d: %d\n",
+				i, ret);
 			goto err_loop;
 		}
 	}
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 41+ messages in thread

* [PATCH 06/17] spi/mpc52xx: Use kmalloc_array() in mpc52xx_spi_probe()
  2017-01-13 17:05 [PATCH 00/17] SPI: Fine-tuning for several function implementations SF Markus Elfring
                   ` (4 preceding siblings ...)
  2017-01-13 17:13 ` [PATCH 05/17] spi: fsl: Combine substrings for two messages SF Markus Elfring
@ 2017-01-13 17:14 ` SF Markus Elfring
  2017-01-17 18:46   ` Applied "spi/mpc52xx: Use kmalloc_array() in mpc52xx_spi_probe()" to the spi tree Mark Brown
  2017-01-13 17:15 ` [PATCH 07/17] spi/mpc52xx: Combine substrings for two messages SF Markus Elfring
                   ` (10 subsequent siblings)
  16 siblings, 1 reply; 41+ messages in thread
From: SF Markus Elfring @ 2017-01-13 17:14 UTC (permalink / raw)
  To: linux-spi, Mark Brown; +Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Fri, 13 Jan 2017 14:06:10 +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 "kmalloc_array".

  This issue was detected by using the Coccinelle software.

* Replace the specification of a data type 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/spi/spi-mpc52xx.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/spi/spi-mpc52xx.c b/drivers/spi/spi-mpc52xx.c
index c36002110c30..8cc129efe7ba 100644
--- a/drivers/spi/spi-mpc52xx.c
+++ b/drivers/spi/spi-mpc52xx.c
@@ -437,8 +437,9 @@ static int mpc52xx_spi_probe(struct platform_device *op)
 	ms->gpio_cs_count = of_gpio_count(op->dev.of_node);
 	if (ms->gpio_cs_count > 0) {
 		master->num_chipselect = ms->gpio_cs_count;
-		ms->gpio_cs = kmalloc(ms->gpio_cs_count * sizeof(unsigned int),
-				GFP_KERNEL);
+		ms->gpio_cs = kmalloc_array(ms->gpio_cs_count,
+					    sizeof(*ms->gpio_cs),
+					    GFP_KERNEL);
 		if (!ms->gpio_cs) {
 			rc = -ENOMEM;
 			goto err_alloc_gpio;
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 41+ messages in thread

* [PATCH 07/17] spi/mpc52xx: Combine substrings for two messages
  2017-01-13 17:05 [PATCH 00/17] SPI: Fine-tuning for several function implementations SF Markus Elfring
                   ` (5 preceding siblings ...)
  2017-01-13 17:14 ` [PATCH 06/17] spi/mpc52xx: Use kmalloc_array() in mpc52xx_spi_probe() SF Markus Elfring
@ 2017-01-13 17:15 ` SF Markus Elfring
  2017-01-17 18:33   ` Mark Brown
  2017-01-17 18:46   ` Applied "spi/mpc52xx: Combine substrings for two messages" to the spi tree Mark Brown
  2017-01-13 17:16 ` [PATCH 08/17] spi/ppc4xx: Use kcalloc() in spi_ppc4xx_of_probe() SF Markus Elfring
                   ` (9 subsequent siblings)
  16 siblings, 2 replies; 41+ messages in thread
From: SF Markus Elfring @ 2017-01-13 17:15 UTC (permalink / raw)
  To: linux-spi, Mark Brown; +Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Fri, 13 Jan 2017 14:14:45 +0100

The script "checkpatch.pl" pointed information out like the following.

WARNING: quoted string split across lines

Thus fix the affected source code places.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/spi/spi-mpc52xx.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/spi/spi-mpc52xx.c b/drivers/spi/spi-mpc52xx.c
index 8cc129efe7ba..e8b59ce4dc3a 100644
--- a/drivers/spi/spi-mpc52xx.c
+++ b/drivers/spi/spi-mpc52xx.c
@@ -449,8 +449,7 @@ static int mpc52xx_spi_probe(struct platform_device *op)
 			gpio_cs = of_get_gpio(op->dev.of_node, i);
 			if (gpio_cs < 0) {
 				dev_err(&op->dev,
-					"could not parse the gpio field "
-					"in oftree\n");
+					"could not parse the gpio field in oftree\n");
 				rc = -ENODEV;
 				goto err_gpio;
 			}
@@ -458,8 +457,8 @@ static int mpc52xx_spi_probe(struct platform_device *op)
 			rc = gpio_request(gpio_cs, dev_name(&op->dev));
 			if (rc) {
 				dev_err(&op->dev,
-					"can't request spi cs gpio #%d "
-					"on gpio line %d\n", i, gpio_cs);
+					"can't request spi cs gpio #%d on gpio line %d\n",
+					i, gpio_cs);
 				goto err_gpio;
 			}
 
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 41+ messages in thread

* [PATCH 08/17] spi/ppc4xx: Use kcalloc() in spi_ppc4xx_of_probe()
  2017-01-13 17:05 [PATCH 00/17] SPI: Fine-tuning for several function implementations SF Markus Elfring
                   ` (6 preceding siblings ...)
  2017-01-13 17:15 ` [PATCH 07/17] spi/mpc52xx: Combine substrings for two messages SF Markus Elfring
@ 2017-01-13 17:16 ` SF Markus Elfring
  2017-01-17 18:45   ` Applied "spi/ppc4xx: Use kcalloc() in spi_ppc4xx_of_probe()" to the spi tree Mark Brown
  2017-01-13 17:18 ` [PATCH 09/17] spi/ppc4xx: Combine substrings for a message in spi_ppc4xx_of_probe() SF Markus Elfring
                   ` (8 subsequent siblings)
  16 siblings, 1 reply; 41+ messages in thread
From: SF Markus Elfring @ 2017-01-13 17:16 UTC (permalink / raw)
  To: linux-spi, Mark Brown; +Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Fri, 13 Jan 2017 14:30:43 +0100

* A multiplication for the size determination of a memory allocation
  indicated that an array data structure should be processed.
  Thus reuse the corresponding function "kcalloc".

  This issue was detected by using the Coccinelle software.

* Replace the specification of a data type 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/spi/spi-ppc4xx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/spi/spi-ppc4xx.c b/drivers/spi/spi-ppc4xx.c
index dd3d0a218d8b..e0c39734d6ef 100644
--- a/drivers/spi/spi-ppc4xx.c
+++ b/drivers/spi/spi-ppc4xx.c
@@ -411,7 +411,7 @@ static int spi_ppc4xx_of_probe(struct platform_device *op)
 	if (num_gpios > 0) {
 		int i;
 
-		hw->gpios = kzalloc(sizeof(int) * num_gpios, GFP_KERNEL);
+		hw->gpios = kcalloc(num_gpios, sizeof(*hw->gpios), GFP_KERNEL);
 		if (!hw->gpios) {
 			ret = -ENOMEM;
 			goto free_master;
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 41+ messages in thread

* [PATCH 09/17] spi/ppc4xx: Combine substrings for a message in spi_ppc4xx_of_probe()
  2017-01-13 17:05 [PATCH 00/17] SPI: Fine-tuning for several function implementations SF Markus Elfring
                   ` (7 preceding siblings ...)
  2017-01-13 17:16 ` [PATCH 08/17] spi/ppc4xx: Use kcalloc() in spi_ppc4xx_of_probe() SF Markus Elfring
@ 2017-01-13 17:18 ` SF Markus Elfring
  2017-01-17 18:45   ` Applied "spi/ppc4xx: Combine substrings for a message in spi_ppc4xx_of_probe()" to the spi tree Mark Brown
  2017-01-13 17:19 ` [PATCH 10/17] spi/ppc4xx: Adjust checks for null pointers in two functions SF Markus Elfring
                   ` (7 subsequent siblings)
  16 siblings, 1 reply; 41+ messages in thread
From: SF Markus Elfring @ 2017-01-13 17:18 UTC (permalink / raw)
  To: linux-spi, Mark Brown; +Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Fri, 13 Jan 2017 14:43:06 +0100

The script "checkpatch.pl" pointed information out like the following.

WARNING: quoted string split across lines

Thus fix the affected source code place.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/spi/spi-ppc4xx.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/spi/spi-ppc4xx.c b/drivers/spi/spi-ppc4xx.c
index e0c39734d6ef..967d94844b30 100644
--- a/drivers/spi/spi-ppc4xx.c
+++ b/drivers/spi/spi-ppc4xx.c
@@ -428,8 +428,9 @@ static int spi_ppc4xx_of_probe(struct platform_device *op)
 				/* Real CS - set the initial state. */
 				ret = gpio_request(gpio, np->name);
 				if (ret < 0) {
-					dev_err(dev, "can't request gpio "
-							"#%d: %d\n", i, ret);
+					dev_err(dev,
+						"can't request gpio #%d: %d\n",
+						i, ret);
 					goto free_gpios;
 				}
 
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 41+ messages in thread

* [PATCH 10/17] spi/ppc4xx: Adjust checks for null pointers in two functions
  2017-01-13 17:05 [PATCH 00/17] SPI: Fine-tuning for several function implementations SF Markus Elfring
                   ` (8 preceding siblings ...)
  2017-01-13 17:18 ` [PATCH 09/17] spi/ppc4xx: Combine substrings for a message in spi_ppc4xx_of_probe() SF Markus Elfring
@ 2017-01-13 17:19 ` SF Markus Elfring
  2017-01-17 18:34   ` Mark Brown
  2017-01-13 17:20 ` [PATCH 11/17] spi/topcliff-pch: Use kcalloc() in pch_spi_handle_dma() SF Markus Elfring
                   ` (6 subsequent siblings)
  16 siblings, 1 reply; 41+ messages in thread
From: SF Markus Elfring @ 2017-01-13 17:19 UTC (permalink / raw)
  To: linux-spi, Mark Brown; +Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Fri, 13 Jan 2017 14:56:10 +0100
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

The script "checkpatch.pl" pointed information out like the following.

Comparison to NULL could be written !…

Thus fix the affected source code places.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/spi/spi-ppc4xx.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/spi/spi-ppc4xx.c b/drivers/spi/spi-ppc4xx.c
index 967d94844b30..048794f043a0 100644
--- a/drivers/spi/spi-ppc4xx.c
+++ b/drivers/spi/spi-ppc4xx.c
@@ -229,7 +229,7 @@ static int spi_ppc4xx_setup(struct spi_device *spi)
 		return -EINVAL;
 	}
 
-	if (cs == NULL) {
+	if (!cs) {
 		cs = kzalloc(sizeof *cs, GFP_KERNEL);
 		if (!cs)
 			return -ENOMEM;
@@ -392,7 +392,7 @@ static int spi_ppc4xx_of_probe(struct platform_device *op)
 	const unsigned int *clk;
 
 	master = spi_alloc_master(dev, sizeof *hw);
-	if (master == NULL)
+	if (!master)
 		return -ENOMEM;
 	master->dev.of_node = np;
 	platform_set_drvdata(op, master);
@@ -466,14 +466,14 @@ static int spi_ppc4xx_of_probe(struct platform_device *op)
 
 	/* Get the clock for the OPB */
 	opbnp = of_find_compatible_node(NULL, NULL, "ibm,opb");
-	if (opbnp == NULL) {
+	if (!opbnp) {
 		dev_err(dev, "OPB: cannot find node\n");
 		ret = -ENODEV;
 		goto free_gpios;
 	}
 	/* Get the clock (Hz) for the OPB */
 	clk = of_get_property(opbnp, "clock-frequency", NULL);
-	if (clk == NULL) {
+	if (!clk) {
 		dev_err(dev, "OPB: no clock-frequency property set\n");
 		of_node_put(opbnp);
 		ret = -ENODEV;
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 41+ messages in thread

* [PATCH 11/17] spi/topcliff-pch: Use kcalloc() in pch_spi_handle_dma()
  2017-01-13 17:05 [PATCH 00/17] SPI: Fine-tuning for several function implementations SF Markus Elfring
                   ` (9 preceding siblings ...)
  2017-01-13 17:19 ` [PATCH 10/17] spi/ppc4xx: Adjust checks for null pointers in two functions SF Markus Elfring
@ 2017-01-13 17:20 ` SF Markus Elfring
  2017-01-17 18:45   ` Applied "spi/topcliff-pch: Use kcalloc() in pch_spi_handle_dma()" to the spi tree Mark Brown
  2017-01-13 17:21 ` [PATCH 12/17] spi/topcliff-pch: Improve size determinations in pch_spi_probe() SF Markus Elfring
                   ` (5 subsequent siblings)
  16 siblings, 1 reply; 41+ messages in thread
From: SF Markus Elfring @ 2017-01-13 17:20 UTC (permalink / raw)
  To: linux-spi, Mark Brown; +Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Fri, 13 Jan 2017 15:25:22 +0100

* Multiplications for the size determination of memory allocations
  indicated that array data structures 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 pointer dereferences
  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/spi/spi-topcliff-pch.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/spi/spi-topcliff-pch.c b/drivers/spi/spi-topcliff-pch.c
index fcb991034c3d..0488b7c7cc19 100644
--- a/drivers/spi/spi-topcliff-pch.c
+++ b/drivers/spi/spi-topcliff-pch.c
@@ -1008,7 +1008,7 @@ static void pch_spi_handle_dma(struct pch_spi_data *data, int *bpw)
 	spin_unlock_irqrestore(&data->lock, flags);
 
 	/* RX */
-	dma->sg_rx_p = kzalloc(sizeof(struct scatterlist)*num, GFP_ATOMIC);
+	dma->sg_rx_p = kcalloc(num, sizeof(*dma->sg_rx_p), GFP_ATOMIC);
 	sg_init_table(dma->sg_rx_p, num); /* Initialize SG table */
 	/* offset, length setting */
 	sg = dma->sg_rx_p;
@@ -1068,7 +1068,7 @@ static void pch_spi_handle_dma(struct pch_spi_data *data, int *bpw)
 		head = 0;
 	}
 
-	dma->sg_tx_p = kzalloc(sizeof(struct scatterlist)*num, GFP_ATOMIC);
+	dma->sg_tx_p = kcalloc(num, sizeof(*dma->sg_tx_p), GFP_ATOMIC);
 	sg_init_table(dma->sg_tx_p, num); /* Initialize SG table */
 	/* offset, length setting */
 	sg = dma->sg_tx_p;
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 41+ messages in thread

* [PATCH 12/17] spi/topcliff-pch: Improve size determinations in pch_spi_probe()
  2017-01-13 17:05 [PATCH 00/17] SPI: Fine-tuning for several function implementations SF Markus Elfring
                   ` (10 preceding siblings ...)
  2017-01-13 17:20 ` [PATCH 11/17] spi/topcliff-pch: Use kcalloc() in pch_spi_handle_dma() SF Markus Elfring
@ 2017-01-13 17:21 ` SF Markus Elfring
  2017-01-17 18:45   ` Applied "spi/topcliff-pch: Improve size determinations in pch_spi_probe()" to the spi tree Mark Brown
  2017-01-13 17:23 ` [PATCH 13/17] spi/topcliff-pch: Delete an unnecessary return statement in two functions SF Markus Elfring
                   ` (4 subsequent siblings)
  16 siblings, 1 reply; 41+ messages in thread
From: SF Markus Elfring @ 2017-01-13 17:21 UTC (permalink / raw)
  To: linux-spi, Mark Brown; +Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Fri, 13 Jan 2017 15:46:35 +0100

Replace the specification of data structures by pointer dereferences
as the parameter for the operator "sizeof" to make the corresponding size
determination a bit safer.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/spi/spi-topcliff-pch.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/spi/spi-topcliff-pch.c b/drivers/spi/spi-topcliff-pch.c
index 0488b7c7cc19..4bba39e70c7b 100644
--- a/drivers/spi/spi-topcliff-pch.c
+++ b/drivers/spi/spi-topcliff-pch.c
@@ -1541,11 +1541,11 @@ static int pch_spi_probe(struct pci_dev *pdev, const struct pci_device_id *id)
 	int i;
 	struct pch_pd_dev_save *pd_dev_save;
 
-	pd_dev_save = kzalloc(sizeof(struct pch_pd_dev_save), GFP_KERNEL);
+	pd_dev_save = kzalloc(sizeof(*pd_dev_save), GFP_KERNEL);
 	if (!pd_dev_save)
 		return -ENOMEM;
 
-	board_dat = kzalloc(sizeof(struct pch_spi_board_data), GFP_KERNEL);
+	board_dat = kzalloc(sizeof(*board_dat), GFP_KERNEL);
 	if (!board_dat) {
 		retval = -ENOMEM;
 		goto err_no_mem;
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 41+ messages in thread

* [PATCH 13/17] spi/topcliff-pch: Delete an unnecessary return statement in two functions
  2017-01-13 17:05 [PATCH 00/17] SPI: Fine-tuning for several function implementations SF Markus Elfring
                   ` (11 preceding siblings ...)
  2017-01-13 17:21 ` [PATCH 12/17] spi/topcliff-pch: Improve size determinations in pch_spi_probe() SF Markus Elfring
@ 2017-01-13 17:23 ` SF Markus Elfring
  2017-01-17 18:45   ` Applied "spi/topcliff-pch: Delete an unnecessary return statement in two functions" to the spi tree Mark Brown
  2017-01-13 17:24 ` [PATCH 14/17] spi/topcliff-pch: Adjust six checks for null pointers SF Markus Elfring
                   ` (3 subsequent siblings)
  16 siblings, 1 reply; 41+ messages in thread
From: SF Markus Elfring @ 2017-01-13 17:23 UTC (permalink / raw)
  To: linux-spi, Mark Brown; +Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Fri, 13 Jan 2017 15:57:03 +0100

The script "checkpatch.pl" pointed information out like the following.

WARNING: void function return statements are not generally useful

Thus remove such statements here.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/spi/spi-topcliff-pch.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/spi/spi-topcliff-pch.c b/drivers/spi/spi-topcliff-pch.c
index 4bba39e70c7b..0a876311b67b 100644
--- a/drivers/spi/spi-topcliff-pch.c
+++ b/drivers/spi/spi-topcliff-pch.c
@@ -915,7 +915,6 @@ static void pch_spi_release_dma(struct pch_spi_data *data)
 		dma_release_channel(dma->chan_rx);
 		dma->chan_rx = NULL;
 	}
-	return;
 }
 
 static void pch_spi_handle_dma(struct pch_spi_data *data, int *bpw)
@@ -1292,7 +1291,6 @@ static void pch_free_dma_buf(struct pch_spi_board_data *board_dat,
 	if (dma->rx_buf_dma)
 		dma_free_coherent(&board_dat->pdev->dev, PCH_BUF_SIZE,
 				  dma->rx_buf_virt, dma->rx_buf_dma);
-	return;
 }
 
 static void pch_alloc_dma_buf(struct pch_spi_board_data *board_dat,
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 41+ messages in thread

* [PATCH 14/17] spi/topcliff-pch: Adjust six checks for null pointers
  2017-01-13 17:05 [PATCH 00/17] SPI: Fine-tuning for several function implementations SF Markus Elfring
                   ` (12 preceding siblings ...)
  2017-01-13 17:23 ` [PATCH 13/17] spi/topcliff-pch: Delete an unnecessary return statement in two functions SF Markus Elfring
@ 2017-01-13 17:24 ` SF Markus Elfring
  2017-01-14  6:36   ` Dan Carpenter
  2017-01-13 17:25 ` [PATCH 15/17] spi/topcliff-pch: Combine substrings for four messages SF Markus Elfring
                   ` (2 subsequent siblings)
  16 siblings, 1 reply; 41+ messages in thread
From: SF Markus Elfring @ 2017-01-13 17:24 UTC (permalink / raw)
  To: linux-spi, Mark Brown; +Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Fri, 13 Jan 2017 16:16:05 +0100
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

The script "checkpatch.pl" pointed information out like the following.

Comparison to NULL could be written …

Thus fix the affected source code places.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/spi/spi-topcliff-pch.c | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/drivers/spi/spi-topcliff-pch.c b/drivers/spi/spi-topcliff-pch.c
index 0a876311b67b..e4f1f66b751b 100644
--- a/drivers/spi/spi-topcliff-pch.c
+++ b/drivers/spi/spi-topcliff-pch.c
@@ -531,12 +531,11 @@ static int pch_spi_transfer(struct spi_device *pspi, struct spi_message *pmsg)
 static inline void pch_spi_select_chip(struct pch_spi_data *data,
 				       struct spi_device *pspi)
 {
-	if (data->current_chip != NULL) {
+	if (data->current_chip)
 		if (pspi->chip_select != data->n_curnt_chip) {
 			dev_dbg(&pspi->dev, "%s : different slave\n", __func__);
 			data->current_chip = NULL;
 		}
-	}
 
 	data->current_chip = pspi;
 
@@ -583,7 +582,7 @@ static void pch_spi_set_tx(struct pch_spi_data *data, int *bpw)
 
 	/* allocate memory for pkt_tx_buff & pkt_rx_buffer */
 	data->pkt_tx_buff = kzalloc(size, GFP_KERNEL);
-	if (data->pkt_tx_buff != NULL) {
+	if (data->pkt_tx_buff) {
 		data->pkt_rx_buff = kzalloc(size, GFP_KERNEL);
 		if (!data->pkt_rx_buff)
 			kfree(data->pkt_tx_buff);
@@ -605,7 +604,7 @@ static void pch_spi_set_tx(struct pch_spi_data *data, int *bpw)
 	}
 
 	/* copy Tx Data */
-	if (data->cur_trans->tx_buf != NULL) {
+	if (data->cur_trans->tx_buf) {
 		if (*bpw == 8) {
 			tx_buf = data->cur_trans->tx_buf;
 			for (j = 0; j < data->bpw_len; j++)
@@ -965,7 +964,7 @@ static void pch_spi_handle_dma(struct pch_spi_data *data, int *bpw)
 	}
 
 	/* copy Tx Data */
-	if (data->cur_trans->tx_buf != NULL) {
+	if (data->cur_trans->tx_buf) {
 		if (*bpw == 8) {
 			tx_buf = data->cur_trans->tx_buf;
 			tx_dma_buf = dma->tx_buf_virt;
@@ -1176,7 +1175,7 @@ static void pch_spi_process_messages(struct work_struct *pwork)
 		transfer structure from the message otherwise retrieve
 		the 1st transfer request from the message. */
 		spin_lock(&data->lock);
-		if (data->cur_trans == NULL) {
+		if (!data->cur_trans) {
 			data->cur_trans =
 				list_entry(data->current_msg->transfers.next,
 					   struct spi_transfer, transfer_list);
@@ -1247,9 +1246,7 @@ static void pch_spi_process_messages(struct work_struct *pwork)
 		}
 
 		spin_unlock(&data->lock);
-
-	} while (data->cur_trans != NULL);
-
+	} while (data->cur_trans);
 out:
 	pch_spi_writereg(data->master, PCH_SSNXCR, SSN_HIGH);
 	if (data->use_dma)
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 41+ messages in thread

* [PATCH 15/17] spi/topcliff-pch: Combine substrings for four messages
  2017-01-13 17:05 [PATCH 00/17] SPI: Fine-tuning for several function implementations SF Markus Elfring
                   ` (13 preceding siblings ...)
  2017-01-13 17:24 ` [PATCH 14/17] spi/topcliff-pch: Adjust six checks for null pointers SF Markus Elfring
@ 2017-01-13 17:25 ` SF Markus Elfring
  2017-01-17 18:45   ` Applied "spi/topcliff-pch: Combine substrings for four messages" to the spi tree Mark Brown
  2017-01-13 17:27 ` [PATCH 16/17] spi/topcliff-pch: Delete an error message for a failed memory allocation in pch_spi_set_tx() SF Markus Elfring
  2017-01-13 17:28 ` [PATCH 17/17] spi/topcliff-pch: One check less in pch_spi_set_tx() SF Markus Elfring
  16 siblings, 1 reply; 41+ messages in thread
From: SF Markus Elfring @ 2017-01-13 17:25 UTC (permalink / raw)
  To: linux-spi, Mark Brown; +Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Fri, 13 Jan 2017 16:36:09 +0100

The script "checkpatch.pl" pointed information out like the following.

WARNING: quoted string split across lines

Thus fix the affected source code places.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/spi/spi-topcliff-pch.c | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/drivers/spi/spi-topcliff-pch.c b/drivers/spi/spi-topcliff-pch.c
index e4f1f66b751b..d36d42653087 100644
--- a/drivers/spi/spi-topcliff-pch.c
+++ b/drivers/spi/spi-topcliff-pch.c
@@ -621,8 +621,9 @@ static void pch_spi_set_tx(struct pch_spi_data *data, int *bpw)
 	if (n_writes > PCH_MAX_FIFO_DEPTH)
 		n_writes = PCH_MAX_FIFO_DEPTH;
 
-	dev_dbg(&data->master->dev, "\n%s:Pulling down SSN low - writing "
-		"0x2 to SSNXCR\n", __func__);
+	dev_dbg(&data->master->dev,
+		"\n%s:Pulling down SSN low - writing 0x2 to SSNXCR\n",
+		__func__);
 	pch_spi_writereg(data->master, PCH_SSNXCR, SSN_LOW);
 
 	for (j = 0; j < n_writes; j++)
@@ -1179,14 +1180,16 @@ static void pch_spi_process_messages(struct work_struct *pwork)
 			data->cur_trans =
 				list_entry(data->current_msg->transfers.next,
 					   struct spi_transfer, transfer_list);
-			dev_dbg(&data->master->dev, "%s "
-				":Getting 1st transfer message\n", __func__);
+			dev_dbg(&data->master->dev,
+				"%s :Getting 1st transfer message\n",
+				__func__);
 		} else {
 			data->cur_trans =
 				list_entry(data->cur_trans->transfer_list.next,
 					   struct spi_transfer, transfer_list);
-			dev_dbg(&data->master->dev, "%s "
-				":Getting next transfer message\n", __func__);
+			dev_dbg(&data->master->dev,
+				"%s :Getting next transfer message\n",
+				__func__);
 		}
 		spin_unlock(&data->lock);
 
@@ -1231,9 +1234,8 @@ static void pch_spi_process_messages(struct work_struct *pwork)
 
 		/* check for delay */
 		if (data->cur_trans->delay_usecs) {
-			dev_dbg(&data->master->dev, "%s:"
-				"delay in usec=%d\n", __func__,
-				data->cur_trans->delay_usecs);
+			dev_dbg(&data->master->dev, "%s:delay in usec=%d\n",
+				__func__, data->cur_trans->delay_usecs);
 			udelay(data->cur_trans->delay_usecs);
 		}
 
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 41+ messages in thread

* [PATCH 16/17] spi/topcliff-pch: Delete an error message for a failed memory allocation in pch_spi_set_tx()
  2017-01-13 17:05 [PATCH 00/17] SPI: Fine-tuning for several function implementations SF Markus Elfring
                   ` (14 preceding siblings ...)
  2017-01-13 17:25 ` [PATCH 15/17] spi/topcliff-pch: Combine substrings for four messages SF Markus Elfring
@ 2017-01-13 17:27 ` SF Markus Elfring
  2017-01-17 18:45   ` Applied "spi/topcliff-pch: Delete an error message for a failed memory allocation in pch_spi_set_tx()" to the spi tree Mark Brown
  2017-01-13 17:28 ` [PATCH 17/17] spi/topcliff-pch: One check less in pch_spi_set_tx() SF Markus Elfring
  16 siblings, 1 reply; 41+ messages in thread
From: SF Markus Elfring @ 2017-01-13 17:27 UTC (permalink / raw)
  To: linux-spi, Mark Brown; +Cc: LKML, kernel-janitors, Wolfram Sang

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Fri, 13 Jan 2017 17:00:08 +0100

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

Link: http://events.linuxfoundation.org/sites/events/files/slides/LCJ16-Refactor_Strings-WSang_0.pdf
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/spi/spi-topcliff-pch.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/spi/spi-topcliff-pch.c b/drivers/spi/spi-topcliff-pch.c
index d36d42653087..97fd1ea9826b 100644
--- a/drivers/spi/spi-topcliff-pch.c
+++ b/drivers/spi/spi-topcliff-pch.c
@@ -590,7 +590,6 @@ static void pch_spi_set_tx(struct pch_spi_data *data, int *bpw)
 
 	if (!data->pkt_rx_buff) {
 		/* flush queue and set status of all transfers to -ENOMEM */
-		dev_err(&data->master->dev, "%s :kzalloc failed\n", __func__);
 		list_for_each_entry_safe(pmsg, tmp, data->queue.next, queue) {
 			pmsg->status = -ENOMEM;
 
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 41+ messages in thread

* [PATCH 17/17] spi/topcliff-pch: One check less in pch_spi_set_tx()
  2017-01-13 17:05 [PATCH 00/17] SPI: Fine-tuning for several function implementations SF Markus Elfring
                   ` (15 preceding siblings ...)
  2017-01-13 17:27 ` [PATCH 16/17] spi/topcliff-pch: Delete an error message for a failed memory allocation in pch_spi_set_tx() SF Markus Elfring
@ 2017-01-13 17:28 ` SF Markus Elfring
  2017-01-13 18:16   ` Geert Uytterhoeven
  16 siblings, 1 reply; 41+ messages in thread
From: SF Markus Elfring @ 2017-01-13 17:28 UTC (permalink / raw)
  To: linux-spi, Mark Brown; +Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Fri, 13 Jan 2017 17:30:46 +0100

Delete a duplicate check after a bit of exception handling was moved into
a previous if branch of this function.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/spi/spi-topcliff-pch.c | 25 ++++++++++++++-----------
 1 file changed, 14 insertions(+), 11 deletions(-)

diff --git a/drivers/spi/spi-topcliff-pch.c b/drivers/spi/spi-topcliff-pch.c
index 97fd1ea9826b..33043a830032 100644
--- a/drivers/spi/spi-topcliff-pch.c
+++ b/drivers/spi/spi-topcliff-pch.c
@@ -584,22 +584,25 @@ static void pch_spi_set_tx(struct pch_spi_data *data, int *bpw)
 	data->pkt_tx_buff = kzalloc(size, GFP_KERNEL);
 	if (data->pkt_tx_buff) {
 		data->pkt_rx_buff = kzalloc(size, GFP_KERNEL);
-		if (!data->pkt_rx_buff)
+		if (!data->pkt_rx_buff) {
 			kfree(data->pkt_tx_buff);
-	}
 
-	if (!data->pkt_rx_buff) {
-		/* flush queue and set status of all transfers to -ENOMEM */
-		list_for_each_entry_safe(pmsg, tmp, data->queue.next, queue) {
-			pmsg->status = -ENOMEM;
+			/*
+			 * Flush queue and set status of all transfers
+			 * to -ENOMEM.
+			 */
+			list_for_each_entry_safe(pmsg, tmp, data->queue.next,
+						 queue) {
+				pmsg->status = -ENOMEM;
 
-			if (pmsg->complete)
-				pmsg->complete(pmsg->context);
+				if (pmsg->complete)
+					pmsg->complete(pmsg->context);
 
-			/* delete from queue */
-			list_del_init(&pmsg->queue);
+				/* delete from queue */
+				list_del_init(&pmsg->queue);
+			}
+			return;
 		}
-		return;
 	}
 
 	/* copy Tx Data */
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 41+ messages in thread

* Re: [PATCH 17/17] spi/topcliff-pch: One check less in pch_spi_set_tx()
  2017-01-13 17:28 ` [PATCH 17/17] spi/topcliff-pch: One check less in pch_spi_set_tx() SF Markus Elfring
@ 2017-01-13 18:16   ` Geert Uytterhoeven
  0 siblings, 0 replies; 41+ messages in thread
From: Geert Uytterhoeven @ 2017-01-13 18:16 UTC (permalink / raw)
  To: SF Markus Elfring; +Cc: linux-spi, Mark Brown, LKML, kernel-janitors

Hi Markus,

On Fri, Jan 13, 2017 at 6:28 PM, SF Markus Elfring
<elfring@users.sourceforge.net> wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Fri, 13 Jan 2017 17:30:46 +0100
>
> Delete a duplicate check after a bit of exception handling was moved into
> a previous if branch of this function.

This is not equivalent: if data->pkt_tx_buff == NULL, the queue is no longer
flushed.

> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
>  drivers/spi/spi-topcliff-pch.c | 25 ++++++++++++++-----------
>  1 file changed, 14 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/spi/spi-topcliff-pch.c b/drivers/spi/spi-topcliff-pch.c
> index 97fd1ea9826b..33043a830032 100644
> --- a/drivers/spi/spi-topcliff-pch.c
> +++ b/drivers/spi/spi-topcliff-pch.c
> @@ -584,22 +584,25 @@ static void pch_spi_set_tx(struct pch_spi_data *data, int *bpw)
>         data->pkt_tx_buff = kzalloc(size, GFP_KERNEL);
>         if (data->pkt_tx_buff) {
>                 data->pkt_rx_buff = kzalloc(size, GFP_KERNEL);
> -               if (!data->pkt_rx_buff)
> +               if (!data->pkt_rx_buff) {
>                         kfree(data->pkt_tx_buff);
> -       }
>
> -       if (!data->pkt_rx_buff) {
> -               /* flush queue and set status of all transfers to -ENOMEM */
> -               list_for_each_entry_safe(pmsg, tmp, data->queue.next, queue) {
> -                       pmsg->status = -ENOMEM;
> +                       /*
> +                        * Flush queue and set status of all transfers
> +                        * to -ENOMEM.
> +                        */
> +                       list_for_each_entry_safe(pmsg, tmp, data->queue.next,
> +                                                queue) {
> +                               pmsg->status = -ENOMEM;
>
> -                       if (pmsg->complete)
> -                               pmsg->complete(pmsg->context);
> +                               if (pmsg->complete)
> +                                       pmsg->complete(pmsg->context);
>
> -                       /* delete from queue */
> -                       list_del_init(&pmsg->queue);
> +                               /* delete from queue */
> +                               list_del_init(&pmsg->queue);
> +                       }
> +                       return;
>                 }
> -               return;
>         }
>
>         /* copy Tx Data */




-- 
Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 41+ messages in thread

* Re: [PATCH 14/17] spi/topcliff-pch: Adjust six checks for null pointers
  2017-01-13 17:24 ` [PATCH 14/17] spi/topcliff-pch: Adjust six checks for null pointers SF Markus Elfring
@ 2017-01-14  6:36   ` Dan Carpenter
  0 siblings, 0 replies; 41+ messages in thread
From: Dan Carpenter @ 2017-01-14  6:36 UTC (permalink / raw)
  To: SF Markus Elfring; +Cc: linux-spi, Mark Brown, LKML, kernel-janitors

On Fri, Jan 13, 2017 at 06:24:22PM +0100, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Fri, 13 Jan 2017 16:16:05 +0100
> MIME-Version: 1.0
> Content-Type: text/plain; charset=UTF-8
> Content-Transfer-Encoding: 8bit
> 
> The script "checkpatch.pl" pointed information out like the following.
> 
> Comparison to NULL could be written …
> 
> Thus fix the affected source code places.
> 
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
>  drivers/spi/spi-topcliff-pch.c | 15 ++++++---------
>  1 file changed, 6 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/spi/spi-topcliff-pch.c b/drivers/spi/spi-topcliff-pch.c
> index 0a876311b67b..e4f1f66b751b 100644
> --- a/drivers/spi/spi-topcliff-pch.c
> +++ b/drivers/spi/spi-topcliff-pch.c
> @@ -531,12 +531,11 @@ static int pch_spi_transfer(struct spi_device *pspi, struct spi_message *pmsg)
>  static inline void pch_spi_select_chip(struct pch_spi_data *data,
>  				       struct spi_device *pspi)
>  {
> -	if (data->current_chip != NULL) {
> +	if (data->current_chip)


Put the curly braces back.  Multi-line indents get curly braces for
readability.

>  		if (pspi->chip_select != data->n_curnt_chip) {
>  			dev_dbg(&pspi->dev, "%s : different slave\n", __func__);
>  			data->current_chip = NULL;
>  		}
> -	}

regards,
dan carpenter

^ permalink raw reply	[flat|nested] 41+ messages in thread

* Re: [PATCH 02/17] spi: Adjust checks for null pointers in two functions
  2017-01-13 17:09 ` [PATCH 02/17] spi: Adjust checks for null pointers in two functions SF Markus Elfring
@ 2017-01-17 18:21   ` Mark Brown
  0 siblings, 0 replies; 41+ messages in thread
From: Mark Brown @ 2017-01-17 18:21 UTC (permalink / raw)
  To: SF Markus Elfring; +Cc: linux-spi, LKML, kernel-janitors

[-- Attachment #1: Type: text/plain, Size: 579 bytes --]

On Fri, Jan 13, 2017 at 06:09:52PM +0100, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Fri, 13 Jan 2017 13:23:32 +0100
> MIME-Version: 1.0
> Content-Type: text/plain; charset=UTF-8
> Content-Transfer-Encoding: 8bit

Something's messed up with your setup for sending out patches here...
can you check please?

> The script "checkpatch.pl" pointed information out like the following.
> 
> Comparison to NULL could be written !…
> 
> Thus fix the affected source code places.

This isn't a fix, it's a stylistic choice.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 41+ messages in thread

* Re: [PATCH 04/17] spi: fsl: Use kmalloc_array() in of_fsl_spi_get_chipselects()
  2017-01-13 17:12 ` [PATCH 04/17] spi: fsl: Use kmalloc_array() in of_fsl_spi_get_chipselects() SF Markus Elfring
@ 2017-01-17 18:27   ` Mark Brown
  2017-01-17 18:46   ` Applied "spi: fsl: Use kmalloc_array() in of_fsl_spi_get_chipselects()" to the spi tree Mark Brown
  1 sibling, 0 replies; 41+ messages in thread
From: Mark Brown @ 2017-01-17 18:27 UTC (permalink / raw)
  To: SF Markus Elfring; +Cc: linux-spi, LKML, kernel-janitors

[-- Attachment #1: Type: text/plain, Size: 637 bytes --]

On Fri, Jan 13, 2017 at 06:12:23PM +0100, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Fri, 13 Jan 2017 13:37:25 +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 "kmalloc_array".

The previous patch changed a similar call site to use kcalloc() with a
similar explanation, the choice of function to translate to seems
entirely random since the changelogs don't address the zeroing that
kzalloc() and kcalloc() do but kmalloc() and kmalloc_array() don't.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 41+ messages in thread

* Re: [PATCH 07/17] spi/mpc52xx: Combine substrings for two messages
  2017-01-13 17:15 ` [PATCH 07/17] spi/mpc52xx: Combine substrings for two messages SF Markus Elfring
@ 2017-01-17 18:33   ` Mark Brown
  2017-01-17 18:46   ` Applied "spi/mpc52xx: Combine substrings for two messages" to the spi tree Mark Brown
  1 sibling, 0 replies; 41+ messages in thread
From: Mark Brown @ 2017-01-17 18:33 UTC (permalink / raw)
  To: SF Markus Elfring; +Cc: linux-spi, LKML, kernel-janitors

[-- Attachment #1: Type: text/plain, Size: 853 bytes --]

On Fri, Jan 13, 2017 at 06:15:54PM +0100, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Fri, 13 Jan 2017 14:14:45 +0100
> 
> The script "checkpatch.pl" pointed information out like the following.
> 
> WARNING: quoted string split across lines
> 
> Thus fix the affected source code places.

You should provide more explanation and analysis for changes than just
saying "checkpatch" - it's not a 100% reliable tool and sometimes it
gives false positives or simply silencing the warning actually makes
things worse (as some of the other feedback on the series shows).  It is
better to provide something in the changelog which explains why the
change improves things, giving credit to checkpatch is of course nice to
do but something that shows an understanding of what it's saying really
helps.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 41+ messages in thread

* Re: [PATCH 10/17] spi/ppc4xx: Adjust checks for null pointers in two functions
  2017-01-13 17:19 ` [PATCH 10/17] spi/ppc4xx: Adjust checks for null pointers in two functions SF Markus Elfring
@ 2017-01-17 18:34   ` Mark Brown
  2017-01-17 18:48     ` SF Markus Elfring
  0 siblings, 1 reply; 41+ messages in thread
From: Mark Brown @ 2017-01-17 18:34 UTC (permalink / raw)
  To: SF Markus Elfring; +Cc: linux-spi, LKML, kernel-janitors

[-- Attachment #1: Type: text/plain, Size: 283 bytes --]

On Fri, Jan 13, 2017 at 06:19:35PM +0100, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Fri, 13 Jan 2017 14:56:10 +0100
> MIME-Version: 1.0
> Content-Type: text/plain; charset=UTF-8
> Content-Transfer-Encoding: 8bit

This is also corrupted.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 41+ messages in thread

* Applied "spi/topcliff-pch: Delete an error message for a failed memory allocation in pch_spi_set_tx()" to the spi tree
  2017-01-13 17:27 ` [PATCH 16/17] spi/topcliff-pch: Delete an error message for a failed memory allocation in pch_spi_set_tx() SF Markus Elfring
@ 2017-01-17 18:45   ` Mark Brown
  0 siblings, 0 replies; 41+ messages in thread
From: Mark Brown @ 2017-01-17 18:45 UTC (permalink / raw)
  To: Markus Elfring
  Cc: Mark Brown, linux-spi, Mark Brown, LKML, kernel-janitors,
	Wolfram Sang, linux-spi

The patch

   spi/topcliff-pch: Delete an error message for a failed memory allocation in pch_spi_set_tx()

has been applied to the spi tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From 45e861a1c12cfd717b8e47103f1aaf2e34cc6688 Mon Sep 17 00:00:00 2001
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Fri, 13 Jan 2017 17:00:08 +0100
Subject: [PATCH] spi/topcliff-pch: Delete an error message for a failed memory
 allocation in pch_spi_set_tx()

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

Link: http://events.linuxfoundation.org/sites/events/files/slides/LCJ16-Refactor_Strings-WSang_0.pdf
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 drivers/spi/spi-topcliff-pch.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/spi/spi-topcliff-pch.c b/drivers/spi/spi-topcliff-pch.c
index 2b9405819075..97d137591b18 100644
--- a/drivers/spi/spi-topcliff-pch.c
+++ b/drivers/spi/spi-topcliff-pch.c
@@ -591,7 +591,6 @@ static void pch_spi_set_tx(struct pch_spi_data *data, int *bpw)
 
 	if (!data->pkt_rx_buff) {
 		/* flush queue and set status of all transfers to -ENOMEM */
-		dev_err(&data->master->dev, "%s :kzalloc failed\n", __func__);
 		list_for_each_entry_safe(pmsg, tmp, data->queue.next, queue) {
 			pmsg->status = -ENOMEM;
 
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 41+ messages in thread

* Applied "spi/topcliff-pch: Combine substrings for four messages" to the spi tree
  2017-01-13 17:25 ` [PATCH 15/17] spi/topcliff-pch: Combine substrings for four messages SF Markus Elfring
@ 2017-01-17 18:45   ` Mark Brown
  0 siblings, 0 replies; 41+ messages in thread
From: Mark Brown @ 2017-01-17 18:45 UTC (permalink / raw)
  To: Markus Elfring
  Cc: Mark Brown, linux-spi, Mark Brown, LKML, kernel-janitors, linux-spi

The patch

   spi/topcliff-pch: Combine substrings for four messages

has been applied to the spi tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From b996356d305fd311eaa652890b255a0ff4d13de4 Mon Sep 17 00:00:00 2001
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Fri, 13 Jan 2017 16:36:09 +0100
Subject: [PATCH] spi/topcliff-pch: Combine substrings for four messages

The script "checkpatch.pl" pointed information out like the following.

WARNING: quoted string split across lines

Thus fix the affected source code places.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 drivers/spi/spi-topcliff-pch.c | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/drivers/spi/spi-topcliff-pch.c b/drivers/spi/spi-topcliff-pch.c
index 0a876311b67b..2b9405819075 100644
--- a/drivers/spi/spi-topcliff-pch.c
+++ b/drivers/spi/spi-topcliff-pch.c
@@ -622,8 +622,9 @@ static void pch_spi_set_tx(struct pch_spi_data *data, int *bpw)
 	if (n_writes > PCH_MAX_FIFO_DEPTH)
 		n_writes = PCH_MAX_FIFO_DEPTH;
 
-	dev_dbg(&data->master->dev, "\n%s:Pulling down SSN low - writing "
-		"0x2 to SSNXCR\n", __func__);
+	dev_dbg(&data->master->dev,
+		"\n%s:Pulling down SSN low - writing 0x2 to SSNXCR\n",
+		__func__);
 	pch_spi_writereg(data->master, PCH_SSNXCR, SSN_LOW);
 
 	for (j = 0; j < n_writes; j++)
@@ -1180,14 +1181,16 @@ static void pch_spi_process_messages(struct work_struct *pwork)
 			data->cur_trans =
 				list_entry(data->current_msg->transfers.next,
 					   struct spi_transfer, transfer_list);
-			dev_dbg(&data->master->dev, "%s "
-				":Getting 1st transfer message\n", __func__);
+			dev_dbg(&data->master->dev,
+				"%s :Getting 1st transfer message\n",
+				__func__);
 		} else {
 			data->cur_trans =
 				list_entry(data->cur_trans->transfer_list.next,
 					   struct spi_transfer, transfer_list);
-			dev_dbg(&data->master->dev, "%s "
-				":Getting next transfer message\n", __func__);
+			dev_dbg(&data->master->dev,
+				"%s :Getting next transfer message\n",
+				__func__);
 		}
 		spin_unlock(&data->lock);
 
@@ -1232,9 +1235,8 @@ static void pch_spi_process_messages(struct work_struct *pwork)
 
 		/* check for delay */
 		if (data->cur_trans->delay_usecs) {
-			dev_dbg(&data->master->dev, "%s:"
-				"delay in usec=%d\n", __func__,
-				data->cur_trans->delay_usecs);
+			dev_dbg(&data->master->dev, "%s:delay in usec=%d\n",
+				__func__, data->cur_trans->delay_usecs);
 			udelay(data->cur_trans->delay_usecs);
 		}
 
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 41+ messages in thread

* Applied "spi/topcliff-pch: Improve size determinations in pch_spi_probe()" to the spi tree
  2017-01-13 17:21 ` [PATCH 12/17] spi/topcliff-pch: Improve size determinations in pch_spi_probe() SF Markus Elfring
@ 2017-01-17 18:45   ` Mark Brown
  0 siblings, 0 replies; 41+ messages in thread
From: Mark Brown @ 2017-01-17 18:45 UTC (permalink / raw)
  To: Markus Elfring
  Cc: Mark Brown, linux-spi, Mark Brown, LKML, kernel-janitors, linux-spi

The patch

   spi/topcliff-pch: Improve size determinations in pch_spi_probe()

has been applied to the spi tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From baa35f5734aa1c0207e4e6b8e15079475b1fa252 Mon Sep 17 00:00:00 2001
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Fri, 13 Jan 2017 15:46:35 +0100
Subject: [PATCH] spi/topcliff-pch: Improve size determinations in
 pch_spi_probe()

Replace the specification of data structures by pointer dereferences
as the parameter for the operator "sizeof" to make the corresponding size
determination a bit safer.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 drivers/spi/spi-topcliff-pch.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/spi/spi-topcliff-pch.c b/drivers/spi/spi-topcliff-pch.c
index 1beeb16e836a..0a876311b67b 100644
--- a/drivers/spi/spi-topcliff-pch.c
+++ b/drivers/spi/spi-topcliff-pch.c
@@ -1539,11 +1539,11 @@ static int pch_spi_probe(struct pci_dev *pdev, const struct pci_device_id *id)
 	int i;
 	struct pch_pd_dev_save *pd_dev_save;
 
-	pd_dev_save = kzalloc(sizeof(struct pch_pd_dev_save), GFP_KERNEL);
+	pd_dev_save = kzalloc(sizeof(*pd_dev_save), GFP_KERNEL);
 	if (!pd_dev_save)
 		return -ENOMEM;
 
-	board_dat = kzalloc(sizeof(struct pch_spi_board_data), GFP_KERNEL);
+	board_dat = kzalloc(sizeof(*board_dat), GFP_KERNEL);
 	if (!board_dat) {
 		retval = -ENOMEM;
 		goto err_no_mem;
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 41+ messages in thread

* Applied "spi/topcliff-pch: Use kcalloc() in pch_spi_handle_dma()" to the spi tree
  2017-01-13 17:20 ` [PATCH 11/17] spi/topcliff-pch: Use kcalloc() in pch_spi_handle_dma() SF Markus Elfring
@ 2017-01-17 18:45   ` Mark Brown
  0 siblings, 0 replies; 41+ messages in thread
From: Mark Brown @ 2017-01-17 18:45 UTC (permalink / raw)
  To: Markus Elfring
  Cc: Mark Brown, linux-spi, Mark Brown, LKML, kernel-janitors, linux-spi

The patch

   spi/topcliff-pch: Use kcalloc() in pch_spi_handle_dma()

has been applied to the spi tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From 84aa0ba12442fa46f461c491c42efdadf6995c96 Mon Sep 17 00:00:00 2001
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Fri, 13 Jan 2017 15:25:22 +0100
Subject: [PATCH] spi/topcliff-pch: Use kcalloc() in pch_spi_handle_dma()

* Multiplications for the size determination of memory allocations
  indicated that array data structures 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 pointer dereferences
  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>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 drivers/spi/spi-topcliff-pch.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/spi/spi-topcliff-pch.c b/drivers/spi/spi-topcliff-pch.c
index 250452a6eead..1beeb16e836a 100644
--- a/drivers/spi/spi-topcliff-pch.c
+++ b/drivers/spi/spi-topcliff-pch.c
@@ -1007,7 +1007,7 @@ static void pch_spi_handle_dma(struct pch_spi_data *data, int *bpw)
 	spin_unlock_irqrestore(&data->lock, flags);
 
 	/* RX */
-	dma->sg_rx_p = kzalloc(sizeof(struct scatterlist)*num, GFP_ATOMIC);
+	dma->sg_rx_p = kcalloc(num, sizeof(*dma->sg_rx_p), GFP_ATOMIC);
 	sg_init_table(dma->sg_rx_p, num); /* Initialize SG table */
 	/* offset, length setting */
 	sg = dma->sg_rx_p;
@@ -1067,7 +1067,7 @@ static void pch_spi_handle_dma(struct pch_spi_data *data, int *bpw)
 		head = 0;
 	}
 
-	dma->sg_tx_p = kzalloc(sizeof(struct scatterlist)*num, GFP_ATOMIC);
+	dma->sg_tx_p = kcalloc(num, sizeof(*dma->sg_tx_p), GFP_ATOMIC);
 	sg_init_table(dma->sg_tx_p, num); /* Initialize SG table */
 	/* offset, length setting */
 	sg = dma->sg_tx_p;
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 41+ messages in thread

* Applied "spi/topcliff-pch: Delete an unnecessary return statement in two functions" to the spi tree
  2017-01-13 17:23 ` [PATCH 13/17] spi/topcliff-pch: Delete an unnecessary return statement in two functions SF Markus Elfring
@ 2017-01-17 18:45   ` Mark Brown
  0 siblings, 0 replies; 41+ messages in thread
From: Mark Brown @ 2017-01-17 18:45 UTC (permalink / raw)
  To: Markus Elfring
  Cc: Mark Brown, linux-spi, Mark Brown, LKML, kernel-janitors, linux-spi

The patch

   spi/topcliff-pch: Delete an unnecessary return statement in two functions

has been applied to the spi tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From 6ceb3b27b1edd1112f1879cc1f149d39a3da2dc2 Mon Sep 17 00:00:00 2001
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Fri, 13 Jan 2017 15:57:03 +0100
Subject: [PATCH] spi/topcliff-pch: Delete an unnecessary return statement in
 two functions

The script "checkpatch.pl" pointed information out like the following.

WARNING: void function return statements are not generally useful

Thus remove such statements here.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 drivers/spi/spi-topcliff-pch.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/spi/spi-topcliff-pch.c b/drivers/spi/spi-topcliff-pch.c
index fcb991034c3d..250452a6eead 100644
--- a/drivers/spi/spi-topcliff-pch.c
+++ b/drivers/spi/spi-topcliff-pch.c
@@ -915,7 +915,6 @@ static void pch_spi_release_dma(struct pch_spi_data *data)
 		dma_release_channel(dma->chan_rx);
 		dma->chan_rx = NULL;
 	}
-	return;
 }
 
 static void pch_spi_handle_dma(struct pch_spi_data *data, int *bpw)
@@ -1292,7 +1291,6 @@ static void pch_free_dma_buf(struct pch_spi_board_data *board_dat,
 	if (dma->rx_buf_dma)
 		dma_free_coherent(&board_dat->pdev->dev, PCH_BUF_SIZE,
 				  dma->rx_buf_virt, dma->rx_buf_dma);
-	return;
 }
 
 static void pch_alloc_dma_buf(struct pch_spi_board_data *board_dat,
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 41+ messages in thread

* Applied "spi/ppc4xx: Use kcalloc() in spi_ppc4xx_of_probe()" to the spi tree
  2017-01-13 17:16 ` [PATCH 08/17] spi/ppc4xx: Use kcalloc() in spi_ppc4xx_of_probe() SF Markus Elfring
@ 2017-01-17 18:45   ` Mark Brown
  0 siblings, 0 replies; 41+ messages in thread
From: Mark Brown @ 2017-01-17 18:45 UTC (permalink / raw)
  To: Markus Elfring
  Cc: Mark Brown, linux-spi, Mark Brown, LKML, kernel-janitors, linux-spi

The patch

   spi/ppc4xx: Use kcalloc() in spi_ppc4xx_of_probe()

has been applied to the spi tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From 797236f10a095a1742373bca5f284c5ec8afb446 Mon Sep 17 00:00:00 2001
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Fri, 13 Jan 2017 14:30:43 +0100
Subject: [PATCH] spi/ppc4xx: Use kcalloc() in spi_ppc4xx_of_probe()

* A multiplication for the size determination of a memory allocation
  indicated that an array data structure should be processed.
  Thus reuse the corresponding function "kcalloc".

  This issue was detected by using the Coccinelle software.

* Replace the specification of a data type 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>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 drivers/spi/spi-ppc4xx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/spi/spi-ppc4xx.c b/drivers/spi/spi-ppc4xx.c
index b2df63c66494..967d94844b30 100644
--- a/drivers/spi/spi-ppc4xx.c
+++ b/drivers/spi/spi-ppc4xx.c
@@ -411,7 +411,7 @@ static int spi_ppc4xx_of_probe(struct platform_device *op)
 	if (num_gpios > 0) {
 		int i;
 
-		hw->gpios = kzalloc(sizeof(int) * num_gpios, GFP_KERNEL);
+		hw->gpios = kcalloc(num_gpios, sizeof(*hw->gpios), GFP_KERNEL);
 		if (!hw->gpios) {
 			ret = -ENOMEM;
 			goto free_master;
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 41+ messages in thread

* Applied "spi/ppc4xx: Combine substrings for a message in spi_ppc4xx_of_probe()" to the spi tree
  2017-01-13 17:18 ` [PATCH 09/17] spi/ppc4xx: Combine substrings for a message in spi_ppc4xx_of_probe() SF Markus Elfring
@ 2017-01-17 18:45   ` Mark Brown
  0 siblings, 0 replies; 41+ messages in thread
From: Mark Brown @ 2017-01-17 18:45 UTC (permalink / raw)
  To: Markus Elfring
  Cc: Mark Brown, linux-spi, Mark Brown, LKML, kernel-janitors, linux-spi

The patch

   spi/ppc4xx: Combine substrings for a message in spi_ppc4xx_of_probe()

has been applied to the spi tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From ffcaef5ac27b62b480b94036615b3ae4f1b725fe Mon Sep 17 00:00:00 2001
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Fri, 13 Jan 2017 14:43:06 +0100
Subject: [PATCH] spi/ppc4xx: Combine substrings for a message in
 spi_ppc4xx_of_probe()

The script "checkpatch.pl" pointed information out like the following.

WARNING: quoted string split across lines

Thus fix the affected source code place.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 drivers/spi/spi-ppc4xx.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/spi/spi-ppc4xx.c b/drivers/spi/spi-ppc4xx.c
index dd3d0a218d8b..b2df63c66494 100644
--- a/drivers/spi/spi-ppc4xx.c
+++ b/drivers/spi/spi-ppc4xx.c
@@ -428,8 +428,9 @@ static int spi_ppc4xx_of_probe(struct platform_device *op)
 				/* Real CS - set the initial state. */
 				ret = gpio_request(gpio, np->name);
 				if (ret < 0) {
-					dev_err(dev, "can't request gpio "
-							"#%d: %d\n", i, ret);
+					dev_err(dev,
+						"can't request gpio #%d: %d\n",
+						i, ret);
 					goto free_gpios;
 				}
 
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 41+ messages in thread

* Applied "spi/mpc52xx: Combine substrings for two messages" to the spi tree
  2017-01-13 17:15 ` [PATCH 07/17] spi/mpc52xx: Combine substrings for two messages SF Markus Elfring
  2017-01-17 18:33   ` Mark Brown
@ 2017-01-17 18:46   ` Mark Brown
  1 sibling, 0 replies; 41+ messages in thread
From: Mark Brown @ 2017-01-17 18:46 UTC (permalink / raw)
  To: Markus Elfring
  Cc: Mark Brown, linux-spi, Mark Brown, LKML, kernel-janitors, linux-spi

The patch

   spi/mpc52xx: Combine substrings for two messages

has been applied to the spi tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From 9c4f0440ba8f3ad57bebb46cfa29a18333fe4860 Mon Sep 17 00:00:00 2001
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Fri, 13 Jan 2017 14:14:45 +0100
Subject: [PATCH] spi/mpc52xx: Combine substrings for two messages

The script "checkpatch.pl" pointed information out like the following.

WARNING: quoted string split across lines

Thus fix the affected source code places.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 drivers/spi/spi-mpc52xx.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/spi/spi-mpc52xx.c b/drivers/spi/spi-mpc52xx.c
index 8cc129efe7ba..e8b59ce4dc3a 100644
--- a/drivers/spi/spi-mpc52xx.c
+++ b/drivers/spi/spi-mpc52xx.c
@@ -449,8 +449,7 @@ static int mpc52xx_spi_probe(struct platform_device *op)
 			gpio_cs = of_get_gpio(op->dev.of_node, i);
 			if (gpio_cs < 0) {
 				dev_err(&op->dev,
-					"could not parse the gpio field "
-					"in oftree\n");
+					"could not parse the gpio field in oftree\n");
 				rc = -ENODEV;
 				goto err_gpio;
 			}
@@ -458,8 +457,8 @@ static int mpc52xx_spi_probe(struct platform_device *op)
 			rc = gpio_request(gpio_cs, dev_name(&op->dev));
 			if (rc) {
 				dev_err(&op->dev,
-					"can't request spi cs gpio #%d "
-					"on gpio line %d\n", i, gpio_cs);
+					"can't request spi cs gpio #%d on gpio line %d\n",
+					i, gpio_cs);
 				goto err_gpio;
 			}
 
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 41+ messages in thread

* Applied "spi/mpc52xx: Use kmalloc_array() in mpc52xx_spi_probe()" to the spi tree
  2017-01-13 17:14 ` [PATCH 06/17] spi/mpc52xx: Use kmalloc_array() in mpc52xx_spi_probe() SF Markus Elfring
@ 2017-01-17 18:46   ` Mark Brown
  0 siblings, 0 replies; 41+ messages in thread
From: Mark Brown @ 2017-01-17 18:46 UTC (permalink / raw)
  To: Markus Elfring
  Cc: Mark Brown, linux-spi, Mark Brown, LKML, kernel-janitors, linux-spi

The patch

   spi/mpc52xx: Use kmalloc_array() in mpc52xx_spi_probe()

has been applied to the spi tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From 8b6c8955b5dc21358cb1f67cadc5514d2353375d Mon Sep 17 00:00:00 2001
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Fri, 13 Jan 2017 14:06:10 +0100
Subject: [PATCH] spi/mpc52xx: Use kmalloc_array() in mpc52xx_spi_probe()

* A multiplication for the size determination of a memory allocation
  indicated that an array data structure should be processed.
  Thus use the corresponding function "kmalloc_array".

  This issue was detected by using the Coccinelle software.

* Replace the specification of a data type 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>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 drivers/spi/spi-mpc52xx.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/spi/spi-mpc52xx.c b/drivers/spi/spi-mpc52xx.c
index c36002110c30..8cc129efe7ba 100644
--- a/drivers/spi/spi-mpc52xx.c
+++ b/drivers/spi/spi-mpc52xx.c
@@ -437,8 +437,9 @@ static int mpc52xx_spi_probe(struct platform_device *op)
 	ms->gpio_cs_count = of_gpio_count(op->dev.of_node);
 	if (ms->gpio_cs_count > 0) {
 		master->num_chipselect = ms->gpio_cs_count;
-		ms->gpio_cs = kmalloc(ms->gpio_cs_count * sizeof(unsigned int),
-				GFP_KERNEL);
+		ms->gpio_cs = kmalloc_array(ms->gpio_cs_count,
+					    sizeof(*ms->gpio_cs),
+					    GFP_KERNEL);
 		if (!ms->gpio_cs) {
 			rc = -ENOMEM;
 			goto err_alloc_gpio;
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 41+ messages in thread

* Applied "spi: fsl: Combine substrings for two messages" to the spi tree
  2017-01-13 17:13 ` [PATCH 05/17] spi: fsl: Combine substrings for two messages SF Markus Elfring
@ 2017-01-17 18:46   ` Mark Brown
  0 siblings, 0 replies; 41+ messages in thread
From: Mark Brown @ 2017-01-17 18:46 UTC (permalink / raw)
  To: Markus Elfring
  Cc: Mark Brown, linux-spi, Mark Brown, LKML, kernel-janitors, linux-spi

The patch

   spi: fsl: Combine substrings for two messages

has been applied to the spi tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From 31ae779421098e9a58a3f10e1e09b2c63f4514fa Mon Sep 17 00:00:00 2001
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Fri, 13 Jan 2017 13:50:21 +0100
Subject: [PATCH] spi: fsl: Combine substrings for two messages

The script "checkpatch.pl" pointed information out like the following.

WARNING: quoted string split across lines

Thus fix the affected source code places.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 drivers/spi/spi-fsl-spi.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/spi/spi-fsl-spi.c b/drivers/spi/spi-fsl-spi.c
index cdee556037f9..0fc3452652ae 100644
--- a/drivers/spi/spi-fsl-spi.c
+++ b/drivers/spi/spi-fsl-spi.c
@@ -267,10 +267,9 @@ static int fsl_spi_setup_transfer(struct spi_device *spi,
 	if ((mpc8xxx_spi->spibrg / hz) > 64) {
 		cs->hw_mode |= SPMODE_DIV16;
 		pm = (mpc8xxx_spi->spibrg - 1) / (hz * 64) + 1;
-
-		WARN_ONCE(pm > 16, "%s: Requested speed is too low: %d Hz. "
-			  "Will use %d Hz instead.\n", dev_name(&spi->dev),
-			  hz, mpc8xxx_spi->spibrg / 1024);
+		WARN_ONCE(pm > 16,
+			  "%s: Requested speed is too low: %d Hz. Will use %d Hz instead.\n",
+			  dev_name(&spi->dev), hz, mpc8xxx_spi->spibrg / 1024);
 		if (pm > 16)
 			pm = 16;
 	} else {
@@ -763,8 +762,9 @@ static int of_fsl_spi_get_chipselects(struct device *dev)
 		ret = gpio_direction_output(pinfo->gpios[i],
 					    pinfo->alow_flags[i]);
 		if (ret) {
-			dev_err(dev, "can't set output direction for gpio "
-				"#%d: %d\n", i, ret);
+			dev_err(dev,
+				"can't set output direction for gpio #%d: %d\n",
+				i, ret);
 			goto err_loop;
 		}
 	}
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 41+ messages in thread

* Applied "spi: fsl: Use kcalloc() in of_fsl_spi_get_chipselects()" to the spi tree
  2017-01-13 17:11 ` [PATCH 03/17] spi: fsl: Use kcalloc() in of_fsl_spi_get_chipselects() SF Markus Elfring
@ 2017-01-17 18:46   ` Mark Brown
  0 siblings, 0 replies; 41+ messages in thread
From: Mark Brown @ 2017-01-17 18:46 UTC (permalink / raw)
  To: Markus Elfring
  Cc: Mark Brown, linux-spi, Mark Brown, LKML, kernel-janitors, linux-spi

The patch

   spi: fsl: Use kcalloc() in of_fsl_spi_get_chipselects()

has been applied to the spi tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From 5223db0b10c7917d7c6b4f7d8e2c0af0eb1158f5 Mon Sep 17 00:00:00 2001
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Fri, 13 Jan 2017 13:33:02 +0100
Subject: [PATCH] spi: fsl: Use kcalloc() in of_fsl_spi_get_chipselects()

A multiplication for the size determination of a memory allocation
indicated that an array data structure should be processed.
Thus reuse the corresponding function "kcalloc".

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 drivers/spi/spi-fsl-spi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/spi/spi-fsl-spi.c b/drivers/spi/spi-fsl-spi.c
index 9873d39d1a95..cdee556037f9 100644
--- a/drivers/spi/spi-fsl-spi.c
+++ b/drivers/spi/spi-fsl-spi.c
@@ -733,7 +733,7 @@ static int of_fsl_spi_get_chipselects(struct device *dev)
 		return -ENOMEM;
 	memset(pinfo->gpios, -1, ngpios * sizeof(*pinfo->gpios));
 
-	pinfo->alow_flags = kzalloc(ngpios * sizeof(*pinfo->alow_flags),
+	pinfo->alow_flags = kcalloc(ngpios, sizeof(*pinfo->alow_flags),
 				    GFP_KERNEL);
 	if (!pinfo->alow_flags) {
 		ret = -ENOMEM;
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 41+ messages in thread

* Applied "spi: fsl: Use kmalloc_array() in of_fsl_spi_get_chipselects()" to the spi tree
  2017-01-13 17:12 ` [PATCH 04/17] spi: fsl: Use kmalloc_array() in of_fsl_spi_get_chipselects() SF Markus Elfring
  2017-01-17 18:27   ` Mark Brown
@ 2017-01-17 18:46   ` Mark Brown
  1 sibling, 0 replies; 41+ messages in thread
From: Mark Brown @ 2017-01-17 18:46 UTC (permalink / raw)
  To: Markus Elfring
  Cc: Mark Brown, linux-spi, Mark Brown, LKML, kernel-janitors, linux-spi

The patch

   spi: fsl: Use kmalloc_array() in of_fsl_spi_get_chipselects()

has been applied to the spi tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From d9bc4a8539a518636cd70d498e94787e32ea8fbe Mon Sep 17 00:00:00 2001
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Fri, 13 Jan 2017 13:37:25 +0100
Subject: [PATCH] spi: fsl: Use kmalloc_array() in of_fsl_spi_get_chipselects()

A multiplication for the size determination of a memory allocation
indicated that an array data structure should be processed.
Thus use the corresponding function "kmalloc_array".

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 drivers/spi/spi-fsl-spi.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/spi/spi-fsl-spi.c b/drivers/spi/spi-fsl-spi.c
index 8b290d9d7935..9873d39d1a95 100644
--- a/drivers/spi/spi-fsl-spi.c
+++ b/drivers/spi/spi-fsl-spi.c
@@ -727,7 +727,8 @@ static int of_fsl_spi_get_chipselects(struct device *dev)
 		return 0;
 	}
 
-	pinfo->gpios = kmalloc(ngpios * sizeof(*pinfo->gpios), GFP_KERNEL);
+	pinfo->gpios = kmalloc_array(ngpios, sizeof(*pinfo->gpios),
+				     GFP_KERNEL);
 	if (!pinfo->gpios)
 		return -ENOMEM;
 	memset(pinfo->gpios, -1, ngpios * sizeof(*pinfo->gpios));
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 41+ messages in thread

* Applied "spi: Use kcalloc() in spi_register_board_info()" to the spi tree
  2017-01-13 17:07 ` [PATCH 01/17] spi: Use kcalloc() in spi_register_board_info() SF Markus Elfring
@ 2017-01-17 18:46   ` Mark Brown
  0 siblings, 0 replies; 41+ messages in thread
From: Mark Brown @ 2017-01-17 18:46 UTC (permalink / raw)
  To: Markus Elfring
  Cc: Mark Brown, linux-spi, Mark Brown, LKML, kernel-janitors, linux-spi

The patch

   spi: Use kcalloc() in spi_register_board_info()

has been applied to the spi tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From f9bdb7fdd2cac17bdc9c344b6036e6939fa087cd Mon Sep 17 00:00:00 2001
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Fri, 13 Jan 2017 12:28:04 +0100
Subject: [PATCH] spi: Use kcalloc() in spi_register_board_info()

A multiplication for the size determination of a memory allocation
indicated that an array data structure should be processed.
Thus reuse the corresponding function "kcalloc".

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 drivers/spi/spi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index 656dd3e3220c..8c05f27bf642 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -672,7 +672,7 @@ int spi_register_board_info(struct spi_board_info const *info, unsigned n)
 	if (!n)
 		return -EINVAL;
 
-	bi = kzalloc(n * sizeof(*bi), GFP_KERNEL);
+	bi = kcalloc(n, sizeof(*bi), GFP_KERNEL);
 	if (!bi)
 		return -ENOMEM;
 
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 41+ messages in thread

* Re: spi/ppc4xx: Adjust checks for null pointers in two functions
  2017-01-17 18:34   ` Mark Brown
@ 2017-01-17 18:48     ` SF Markus Elfring
  2017-01-17 19:11       ` Mark Brown
  0 siblings, 1 reply; 41+ messages in thread
From: SF Markus Elfring @ 2017-01-17 18:48 UTC (permalink / raw)
  To: Mark Brown; +Cc: linux-spi, LKML, kernel-janitors

>> From: Markus Elfring <elfring@users.sourceforge.net>
>> Date: Fri, 13 Jan 2017 14:56:10 +0100
>> MIME-Version: 1.0
>> Content-Type: text/plain; charset=UTF-8
>> Content-Transfer-Encoding: 8bit
> 
> This is also corrupted.

Would you like to explain this information a bit more?


The published patch looks reasonable in principle by other interfaces,
doesn't it?
https://lkml.org/lkml/2017/1/13/609
https://patchwork.kernel.org/patch/9516059/
https://lkml.kernel.org/r/<d9bd24b0-d4d5-233c-756d-71aaed63c5ef@users.sourceforge.net>

Regards,
Markus

^ permalink raw reply	[flat|nested] 41+ messages in thread

* Re: spi/ppc4xx: Adjust checks for null pointers in two functions
  2017-01-17 18:48     ` SF Markus Elfring
@ 2017-01-17 19:11       ` Mark Brown
  2017-01-17 19:28         ` SF Markus Elfring
  0 siblings, 1 reply; 41+ messages in thread
From: Mark Brown @ 2017-01-17 19:11 UTC (permalink / raw)
  To: SF Markus Elfring; +Cc: linux-spi, LKML, kernel-janitors

[-- Attachment #1: Type: text/plain, Size: 425 bytes --]

On Tue, Jan 17, 2017 at 07:48:26PM +0100, SF Markus Elfring wrote:
> >> From: Markus Elfring <elfring@users.sourceforge.net>
> >> Date: Fri, 13 Jan 2017 14:56:10 +0100
> >> MIME-Version: 1.0
> >> Content-Type: text/plain; charset=UTF-8
> >> Content-Transfer-Encoding: 8bit

> > This is also corrupted.

> Would you like to explain this information a bit more?

You've got MIME headers in the middle of the patch description.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 41+ messages in thread

* Re: spi/ppc4xx: Adjust checks for null pointers in two functions
  2017-01-17 19:11       ` Mark Brown
@ 2017-01-17 19:28         ` SF Markus Elfring
  2017-01-17 19:37           ` Mark Brown
  0 siblings, 1 reply; 41+ messages in thread
From: SF Markus Elfring @ 2017-01-17 19:28 UTC (permalink / raw)
  To: Mark Brown; +Cc: linux-spi, LKML, kernel-janitors

> You've got MIME headers in the middle of the patch description.

The extra header fields were automatically added by the tool “git”
because I dared to use an Unicode character in the commit message
for this patch (and a few others).

Would you like to change the mentioned implementation detail at all?

Regards,
Markus

^ permalink raw reply	[flat|nested] 41+ messages in thread

* Re: spi/ppc4xx: Adjust checks for null pointers in two functions
  2017-01-17 19:28         ` SF Markus Elfring
@ 2017-01-17 19:37           ` Mark Brown
  0 siblings, 0 replies; 41+ messages in thread
From: Mark Brown @ 2017-01-17 19:37 UTC (permalink / raw)
  To: SF Markus Elfring; +Cc: linux-spi, LKML, kernel-janitors

[-- Attachment #1: Type: text/plain, Size: 598 bytes --]

On Tue, Jan 17, 2017 at 08:28:12PM +0100, SF Markus Elfring wrote:
> > You've got MIME headers in the middle of the patch description.

> The extra header fields were automatically added by the tool “git”
> because I dared to use an Unicode character in the commit message
> for this patch (and a few others).

> Would you like to change the mentioned implementation detail at all?

Well, I've deleted the mails now so...

Better yet would be to send patches with a sender address matching the
author information in your patches so they don't get any mangling in the
body at all.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 41+ messages in thread

end of thread, other threads:[~2017-01-17 19:37 UTC | newest]

Thread overview: 41+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-13 17:05 [PATCH 00/17] SPI: Fine-tuning for several function implementations SF Markus Elfring
2017-01-13 17:07 ` [PATCH 01/17] spi: Use kcalloc() in spi_register_board_info() SF Markus Elfring
2017-01-17 18:46   ` Applied "spi: Use kcalloc() in spi_register_board_info()" to the spi tree Mark Brown
2017-01-13 17:09 ` [PATCH 02/17] spi: Adjust checks for null pointers in two functions SF Markus Elfring
2017-01-17 18:21   ` Mark Brown
2017-01-13 17:11 ` [PATCH 03/17] spi: fsl: Use kcalloc() in of_fsl_spi_get_chipselects() SF Markus Elfring
2017-01-17 18:46   ` Applied "spi: fsl: Use kcalloc() in of_fsl_spi_get_chipselects()" to the spi tree Mark Brown
2017-01-13 17:12 ` [PATCH 04/17] spi: fsl: Use kmalloc_array() in of_fsl_spi_get_chipselects() SF Markus Elfring
2017-01-17 18:27   ` Mark Brown
2017-01-17 18:46   ` Applied "spi: fsl: Use kmalloc_array() in of_fsl_spi_get_chipselects()" to the spi tree Mark Brown
2017-01-13 17:13 ` [PATCH 05/17] spi: fsl: Combine substrings for two messages SF Markus Elfring
2017-01-17 18:46   ` Applied "spi: fsl: Combine substrings for two messages" to the spi tree Mark Brown
2017-01-13 17:14 ` [PATCH 06/17] spi/mpc52xx: Use kmalloc_array() in mpc52xx_spi_probe() SF Markus Elfring
2017-01-17 18:46   ` Applied "spi/mpc52xx: Use kmalloc_array() in mpc52xx_spi_probe()" to the spi tree Mark Brown
2017-01-13 17:15 ` [PATCH 07/17] spi/mpc52xx: Combine substrings for two messages SF Markus Elfring
2017-01-17 18:33   ` Mark Brown
2017-01-17 18:46   ` Applied "spi/mpc52xx: Combine substrings for two messages" to the spi tree Mark Brown
2017-01-13 17:16 ` [PATCH 08/17] spi/ppc4xx: Use kcalloc() in spi_ppc4xx_of_probe() SF Markus Elfring
2017-01-17 18:45   ` Applied "spi/ppc4xx: Use kcalloc() in spi_ppc4xx_of_probe()" to the spi tree Mark Brown
2017-01-13 17:18 ` [PATCH 09/17] spi/ppc4xx: Combine substrings for a message in spi_ppc4xx_of_probe() SF Markus Elfring
2017-01-17 18:45   ` Applied "spi/ppc4xx: Combine substrings for a message in spi_ppc4xx_of_probe()" to the spi tree Mark Brown
2017-01-13 17:19 ` [PATCH 10/17] spi/ppc4xx: Adjust checks for null pointers in two functions SF Markus Elfring
2017-01-17 18:34   ` Mark Brown
2017-01-17 18:48     ` SF Markus Elfring
2017-01-17 19:11       ` Mark Brown
2017-01-17 19:28         ` SF Markus Elfring
2017-01-17 19:37           ` Mark Brown
2017-01-13 17:20 ` [PATCH 11/17] spi/topcliff-pch: Use kcalloc() in pch_spi_handle_dma() SF Markus Elfring
2017-01-17 18:45   ` Applied "spi/topcliff-pch: Use kcalloc() in pch_spi_handle_dma()" to the spi tree Mark Brown
2017-01-13 17:21 ` [PATCH 12/17] spi/topcliff-pch: Improve size determinations in pch_spi_probe() SF Markus Elfring
2017-01-17 18:45   ` Applied "spi/topcliff-pch: Improve size determinations in pch_spi_probe()" to the spi tree Mark Brown
2017-01-13 17:23 ` [PATCH 13/17] spi/topcliff-pch: Delete an unnecessary return statement in two functions SF Markus Elfring
2017-01-17 18:45   ` Applied "spi/topcliff-pch: Delete an unnecessary return statement in two functions" to the spi tree Mark Brown
2017-01-13 17:24 ` [PATCH 14/17] spi/topcliff-pch: Adjust six checks for null pointers SF Markus Elfring
2017-01-14  6:36   ` Dan Carpenter
2017-01-13 17:25 ` [PATCH 15/17] spi/topcliff-pch: Combine substrings for four messages SF Markus Elfring
2017-01-17 18:45   ` Applied "spi/topcliff-pch: Combine substrings for four messages" to the spi tree Mark Brown
2017-01-13 17:27 ` [PATCH 16/17] spi/topcliff-pch: Delete an error message for a failed memory allocation in pch_spi_set_tx() SF Markus Elfring
2017-01-17 18:45   ` Applied "spi/topcliff-pch: Delete an error message for a failed memory allocation in pch_spi_set_tx()" to the spi tree Mark Brown
2017-01-13 17:28 ` [PATCH 17/17] spi/topcliff-pch: One check less in pch_spi_set_tx() SF Markus Elfring
2017-01-13 18:16   ` Geert Uytterhoeven

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).