linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] RapidIO: Tsi721-DMA: Adjustments for five function implementations
@ 2017-12-15 16:32 SF Markus Elfring
  2017-12-15 16:34 ` [PATCH 1/3] rapidio: tsi721_dma: Delete an error message for a failed memory allocation in tsi721_alloc_chan_resources() SF Markus Elfring
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: SF Markus Elfring @ 2017-12-15 16:32 UTC (permalink / raw)
  To: kernel-janitors, Alexandre Bounine, Matt Porter; +Cc: LKML

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Fri, 15 Dec 2017 17:28:32 +0100

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

Markus Elfring (3):
  Delete an error message for a failed memory allocation in tsi721_alloc_chan_resources()
  Delete an unnecessary variable initialisation in tsi721_alloc_chan_resources()
  Adjust six checks for null pointers

 drivers/rapidio/devices/tsi721_dma.c | 17 ++++++-----------
 1 file changed, 6 insertions(+), 11 deletions(-)

-- 
2.15.1

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

* [PATCH 1/3] rapidio: tsi721_dma: Delete an error message for a failed memory allocation in tsi721_alloc_chan_resources()
  2017-12-15 16:32 [PATCH 0/3] RapidIO: Tsi721-DMA: Adjustments for five function implementations SF Markus Elfring
@ 2017-12-15 16:34 ` SF Markus Elfring
  2017-12-15 16:36 ` [PATCH 2/3] rapidio: tsi721_dma: Delete an unnecessary variable initialisation " SF Markus Elfring
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: SF Markus Elfring @ 2017-12-15 16:34 UTC (permalink / raw)
  To: kernel-janitors, Alexandre Bounine, Matt Porter; +Cc: LKML

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Fri, 15 Dec 2017 14:11:08 +0100

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

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/rapidio/devices/tsi721_dma.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/rapidio/devices/tsi721_dma.c b/drivers/rapidio/devices/tsi721_dma.c
index e2a418598129..f7bc85a27d1b 100644
--- a/drivers/rapidio/devices/tsi721_dma.c
+++ b/drivers/rapidio/devices/tsi721_dma.c
@@ -754,9 +754,6 @@ static int tsi721_alloc_chan_resources(struct dma_chan *dchan)
 	desc = kcalloc(dma_txqueue_sz, sizeof(struct tsi721_tx_desc),
 			GFP_ATOMIC);
 	if (!desc) {
-		tsi_err(&dchan->dev->device,
-			"DMAC%d Failed to allocate logical descriptors",
-			bdma_chan->id);
 		tsi721_bdma_ch_free(bdma_chan);
 		return -ENOMEM;
 	}
-- 
2.15.1

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

* [PATCH 2/3] rapidio: tsi721_dma: Delete an unnecessary variable initialisation in tsi721_alloc_chan_resources()
  2017-12-15 16:32 [PATCH 0/3] RapidIO: Tsi721-DMA: Adjustments for five function implementations SF Markus Elfring
  2017-12-15 16:34 ` [PATCH 1/3] rapidio: tsi721_dma: Delete an error message for a failed memory allocation in tsi721_alloc_chan_resources() SF Markus Elfring
@ 2017-12-15 16:36 ` SF Markus Elfring
  2017-12-15 16:37 ` [PATCH 3/3] rapidio: tsi721_dma: Adjust six checks for null pointers SF Markus Elfring
  2017-12-21 13:59 ` [PATCH 0/3] RapidIO: Tsi721-DMA: Adjustments for five function implementations Bounine, Alexandre
  3 siblings, 0 replies; 5+ messages in thread
From: SF Markus Elfring @ 2017-12-15 16:36 UTC (permalink / raw)
  To: kernel-janitors, Alexandre Bounine, Matt Porter; +Cc: LKML

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Fri, 15 Dec 2017 14:22:44 +0100

The local variable "desc" will eventually be set to an appropriate pointer
a bit later. Thus omit the explicit initialisation at the beginning.

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

diff --git a/drivers/rapidio/devices/tsi721_dma.c b/drivers/rapidio/devices/tsi721_dma.c
index f7bc85a27d1b..14fc36ac3d85 100644
--- a/drivers/rapidio/devices/tsi721_dma.c
+++ b/drivers/rapidio/devices/tsi721_dma.c
@@ -735,7 +735,7 @@ static dma_cookie_t tsi721_tx_submit(struct dma_async_tx_descriptor *txd)
 static int tsi721_alloc_chan_resources(struct dma_chan *dchan)
 {
 	struct tsi721_bdma_chan *bdma_chan = to_tsi721_chan(dchan);
-	struct tsi721_tx_desc *desc = NULL;
+	struct tsi721_tx_desc *desc;
 	int i;
 
 	tsi_debug(DMA, &dchan->dev->device, "DMAC%d", bdma_chan->id);
-- 
2.15.1

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

* [PATCH 3/3] rapidio: tsi721_dma: Adjust six checks for null pointers
  2017-12-15 16:32 [PATCH 0/3] RapidIO: Tsi721-DMA: Adjustments for five function implementations SF Markus Elfring
  2017-12-15 16:34 ` [PATCH 1/3] rapidio: tsi721_dma: Delete an error message for a failed memory allocation in tsi721_alloc_chan_resources() SF Markus Elfring
  2017-12-15 16:36 ` [PATCH 2/3] rapidio: tsi721_dma: Delete an unnecessary variable initialisation " SF Markus Elfring
@ 2017-12-15 16:37 ` SF Markus Elfring
  2017-12-21 13:59 ` [PATCH 0/3] RapidIO: Tsi721-DMA: Adjustments for five function implementations Bounine, Alexandre
  3 siblings, 0 replies; 5+ messages in thread
From: SF Markus Elfring @ 2017-12-15 16:37 UTC (permalink / raw)
  To: kernel-janitors, Alexandre Bounine, Matt Porter; +Cc: LKML

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Fri, 15 Dec 2017 14:35:21 +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/rapidio/devices/tsi721_dma.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/drivers/rapidio/devices/tsi721_dma.c b/drivers/rapidio/devices/tsi721_dma.c
index 14fc36ac3d85..006ea5a45020 100644
--- a/drivers/rapidio/devices/tsi721_dma.c
+++ b/drivers/rapidio/devices/tsi721_dma.c
@@ -222,7 +222,7 @@ static int tsi721_bdma_ch_free(struct tsi721_bdma_chan *bdma_chan)
 	struct tsi721_device *priv = to_tsi721(bdma_chan->dchan.device);
 #endif
 
-	if (bdma_chan->bd_base == NULL)
+	if (!bdma_chan->bd_base)
 		return 0;
 
 	/* Check if DMA channel still running */
@@ -346,7 +346,7 @@ tsi721_desc_fill_init(struct tsi721_tx_desc *desc,
 {
 	u64 rio_addr;
 
-	if (bd_ptr == NULL)
+	if (!bd_ptr)
 		return -EINVAL;
 
 	/* Initialize DMA descriptor */
@@ -370,7 +370,7 @@ tsi721_desc_fill_init(struct tsi721_tx_desc *desc,
 static int
 tsi721_desc_fill_end(struct tsi721_dma_desc *bd_ptr, u32 bcount, bool interrupt)
 {
-	if (bd_ptr == NULL)
+	if (!bd_ptr)
 		return -EINVAL;
 
 	/* Update DMA descriptor */
@@ -555,9 +555,7 @@ static void tsi721_advance_work(struct tsi721_bdma_chan *bdma_chan,
 	 * If there is no data transfer in progress, fetch new descriptor from
 	 * the pending queue.
 	*/
-
-	if (desc == NULL && bdma_chan->active_tx == NULL &&
-					!list_empty(&bdma_chan->queue)) {
+	if (!desc && !bdma_chan->active_tx && !list_empty(&bdma_chan->queue)) {
 		desc = list_first_entry(&bdma_chan->queue,
 					struct tsi721_tx_desc, desc_node);
 		list_del_init((&desc->desc_node));
@@ -796,7 +794,7 @@ static void tsi721_free_chan_resources(struct dma_chan *dchan)
 
 	tsi_debug(DMA, &dchan->dev->device, "DMAC%d", bdma_chan->id);
 
-	if (bdma_chan->bd_base == NULL)
+	if (!bdma_chan->bd_base)
 		return;
 
 	tsi721_bdma_interrupt_enable(bdma_chan, 0);
-- 
2.15.1

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

* RE: [PATCH 0/3] RapidIO: Tsi721-DMA: Adjustments for five function implementations
  2017-12-15 16:32 [PATCH 0/3] RapidIO: Tsi721-DMA: Adjustments for five function implementations SF Markus Elfring
                   ` (2 preceding siblings ...)
  2017-12-15 16:37 ` [PATCH 3/3] rapidio: tsi721_dma: Adjust six checks for null pointers SF Markus Elfring
@ 2017-12-21 13:59 ` Bounine, Alexandre
  3 siblings, 0 replies; 5+ messages in thread
From: Bounine, Alexandre @ 2017-12-21 13:59 UTC (permalink / raw)
  To: SF Markus Elfring, kernel-janitors, Matt Porter, Andrew Morton; +Cc: LKML

Acked-by: Alexandre Bounine <alexandre.bounine@idt.com>


-----Original Message-----
From: SF Markus Elfring [mailto:elfring@users.sourceforge.net] 
Sent: Friday, December 15, 2017 11:33 AM
To: kernel-janitors@vger.kernel.org; Bounine, Alexandre <Alexandre.Bounine@idt.com>; Matt Porter <mporter@kernel.crashing.org>
Cc: LKML <linux-kernel@vger.kernel.org>
Subject: [PATCH 0/3] RapidIO: Tsi721-DMA: Adjustments for five function implementations

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Fri, 15 Dec 2017 17:28:32 +0100

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

Markus Elfring (3):
  Delete an error message for a failed memory allocation in tsi721_alloc_chan_resources()
  Delete an unnecessary variable initialisation in tsi721_alloc_chan_resources()
  Adjust six checks for null pointers

 drivers/rapidio/devices/tsi721_dma.c | 17 ++++++-----------
 1 file changed, 6 insertions(+), 11 deletions(-)

-- 
2.15.1

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

end of thread, other threads:[~2017-12-21 14:00 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-15 16:32 [PATCH 0/3] RapidIO: Tsi721-DMA: Adjustments for five function implementations SF Markus Elfring
2017-12-15 16:34 ` [PATCH 1/3] rapidio: tsi721_dma: Delete an error message for a failed memory allocation in tsi721_alloc_chan_resources() SF Markus Elfring
2017-12-15 16:36 ` [PATCH 2/3] rapidio: tsi721_dma: Delete an unnecessary variable initialisation " SF Markus Elfring
2017-12-15 16:37 ` [PATCH 3/3] rapidio: tsi721_dma: Adjust six checks for null pointers SF Markus Elfring
2017-12-21 13:59 ` [PATCH 0/3] RapidIO: Tsi721-DMA: Adjustments for five function implementations Bounine, Alexandre

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