Skip to contentSkip to conversation

SoC-TI-knav_dma: Fine-tuning for three function implementations

PATCH In review SF Markus Elfring 2 participants 5 messages May 1, 2017 – Jan 19, 2018

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover SoC-TI-knav_dma: Fine-tuning for three function implementations

From: Markus Elfring <[email protected]>
Date: Mon, 1 May 2017 21:21:42 +0200

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

Markus Elfring (3):
Use seq_putc() in dma_debug_show_channels()
Improve a size determination in knav_dma_probe()
Delete error messages for a failed memory allocation in two functions

 drivers/soc/ti/knav_dma.c | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)
Signature · 1 line
2.12.2
#1 lore raw

PATCH 1/3 soc-knav_dma: Use seq_putc() in dma_debug_show_channels()

From: Markus Elfring <[email protected]>
Date: Mon, 1 May 2017 20:55:55 +0200

A single character (line break) should be put into a sequence. Thus use the corresponding function "seq_putc".

This issue was detected by using the Coccinelle software.

---
 drivers/soc/ti/knav_dma.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/soc/ti/knav_dma.c +1 -1
index ecebe2eecc3a..a66671a93199 100644
@@ -333,7 +333,7 @@ static void dma_debug_show_channels(struct seq_file *s,
 			chan->cfg.u.rx.thresh);
 		for (i = 0; i < KNAV_DMA_FDQ_PER_CHAN; i++)
 			seq_printf(s, "[%d]", chan->cfg.u.rx.fdq[i]);
-		seq_printf(s, "\n");
+		seq_putc(s, '\n');
 	}
 }
 
Signature · 1 line
2.12.2
#2 lore raw

Re: [PATCH 1/3] soc-knav_dma: Use seq_putc() in dma_debug_show_channels()

Quoted 10 lines · SF Markus Elfring

From: Markus Elfring <[email protected]>
Date: Mon, 1 May 2017 20:55:55 +0200

A single character (line break) should be put into a sequence. Thus use the corresponding function "seq_putc".

This issue was detected by using the Coccinelle software.

---

Will pick all three patches. Thanks !!

#3 lore raw

PATCH 2/3 soc-knav_dma: Improve a size determination in knav_dma_probe()

In reply to SF Markus Elfring

From: Markus Elfring <[email protected]>
Date: Mon, 1 May 2017 21:06:46 +0200

Replace the specification of a data structure by a pointer dereference as the parameter for the operator "sizeof" to make the corresponding size determination a bit safer according to the Linux coding style convention.

---
 drivers/soc/ti/knav_dma.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/soc/ti/knav_dma.c +1 -2
index a66671a93199..410018d9054e 100644
@@ -739,8 +739,7 @@ static int knav_dma_probe(struct platform_device *pdev)
 		return -EINVAL;
 	}
 
-	kdev = devm_kzalloc(dev,
-			sizeof(struct knav_dma_pool_device), GFP_KERNEL);
+	kdev = devm_kzalloc(dev, sizeof(*kdev), GFP_KERNEL);
 	if (!kdev) {
 		dev_err(dev, "could not allocate driver mem\n");
 		return -ENOMEM;
Signature · 1 line
2.12.2
#4 lore raw

PATCH 3/3 soc-knav_dma: Delete error messages for a failed memory allocation in two functions

In reply to SF Markus Elfring

From: Markus Elfring <[email protected]>
Date: Mon, 1 May 2017 21:14:48 +0200

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

WARNING: Possible unnecessary 'out of memory' message

Thus remove such statements here.

---
 drivers/soc/ti/knav_dma.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)
drivers/soc/ti/knav_dma.c +3 -6
index 410018d9054e..dd5adfbf9910 100644
@@ -621,10 +621,9 @@ static int dma_init(struct device_node *cloud, struct device_node *dma_node)
 	u32 i;
 
 	dma = devm_kzalloc(kdev->dev, sizeof(*dma), GFP_KERNEL);
-	if (!dma) {
-		dev_err(kdev->dev, "could not allocate driver mem\n");
+	if (!dma)
 		return -ENOMEM;
-	}
+
 	INIT_LIST_HEAD(&dma->list);
 	INIT_LIST_HEAD(&dma->chan_list);
 
@@ -740,10 +739,8 @@ static int knav_dma_probe(struct platform_device *pdev)
 	}
 
 	kdev = devm_kzalloc(dev, sizeof(*kdev), GFP_KERNEL);
-	if (!kdev) {
-		dev_err(dev, "could not allocate driver mem\n");
+	if (!kdev)
 		return -ENOMEM;
-	}
 
 	kdev->dev = dev;
 	INIT_LIST_HEAD(&kdev->list);
Signature · 1 line
2.12.2