RapidIO: Tsi721-DMA: Adjustments for five function implementations
Subsystems (2)
cover RapidIO: Tsi721-DMA: Adjustments for five function implementations
From: Markus Elfring <[email protected]>
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(-)
Signature · 1 line
2.15.1
PATCH 1/3 rapidio: tsi721_dma: Delete an error message for a failed memory allocation in tsi721_alloc_chan_resources()
From: Markus Elfring <[email protected]>
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.
--- drivers/rapidio/devices/tsi721_dma.c | 3 --- 1 file changed, 3 deletions(-)
drivers/rapidio/devices/tsi721_dma.c +0 -3
@@ -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 ; }
Signature · 1 line
2.15.1
PATCH 2/3 rapidio: tsi721_dma: Delete an unnecessary variable initialisation in tsi721_alloc_chan_resources()
In reply to SF Markus ElfringFrom: Markus Elfring <[email protected]>
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.
--- drivers/rapidio/devices/tsi721_dma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/rapidio/devices/tsi721_dma.c +1 -1
@@ -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);
Signature · 1 line
2.15.1
PATCH 3/3 rapidio: tsi721_dma: Adjust six checks for null pointers
In reply to SF Markus ElfringFrom: Markus Elfring <[email protected]>
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.
--- drivers/rapidio/devices/tsi721_dma.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-)
drivers/rapidio/devices/tsi721_dma.c +5 -7
@@ -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 );
Signature · 1 line
2.15.1
QWNrZWQtYnk6IEFsZXhhbmRyZSBCb3VuaW5lIDxhbGV4YW5kcmUuYm91bmluZUBpZHQuY29tPg0K DQoNCi0tLS0tT3JpZ2luYWwgTWVzc2FnZS0tLS0tDQpGcm9tOiBTRiBNYXJrdXMgRWxmcmluZyBb bWFpbHRvOmVsZnJpbmdAdXNlcnMuc291cmNlZm9yZ2UubmV0XSANClNlbnQ6IEZyaWRheSwgRGVj ZW1iZXIgMTUsIDIwMTcgMTE6MzMgQU0NClRvOiBrZXJuZWwtamFuaXRvcnNAdmdlci5rZXJuZWwu b3JnOyBCb3VuaW5lLCBBbGV4YW5kcmUgPEFsZXhhbmRyZS5Cb3VuaW5lQGlkdC5jb20+OyBNYXR0 IFBvcnRlciA8bXBvcnRlckBrZXJuZWwuY3Jhc2hpbmcub3JnPg0KQ2M6IExLTUwgPGxpbnV4LWtl cm5lbEB2Z2VyLmtlcm5lbC5vcmc+DQpTdWJqZWN0OiBbUEFUQ0ggMC8zXSBSYXBpZElPOiBUc2k3 MjEtRE1BOiBBZGp1c3RtZW50cyBmb3IgZml2ZSBmdW5jdGlvbiBpbXBsZW1lbnRhdGlvbnMNCg0K RnJvbTogTWFya3VzIEVsZnJpbmcgPGVsZnJpbmdAdXNlcnMuc291cmNlZm9yZ2UubmV0Pg0KRGF0 ZTogRnJpLCAxNSBEZWMgMjAxNyAxNzoyODozMiArMDEwMA0KDQpUaHJlZSB1cGRhdGUgc3VnZ2Vz dGlvbnMgd2VyZSB0YWtlbiBpbnRvIGFjY291bnQNCmZyb20gc3RhdGljIHNvdXJjZSBjb2RlIGFu YWx5c2lzLg0KDQpNYXJrdXMgRWxmcmluZyAo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