Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1632351 > unrolled thread

[PATCH 0/2] hwtracing-coresight: Fine-tuning for two function implementations

Started bySF Markus Elfring <elfring@users.sourceforge.net>
First post2017-04-27 21:50 +0200
Last post2017-04-27 21:50 +0200
Articles 2 — 1 participant

Back to article view | Back to linux.kernel


Contents

  [PATCH 0/2] hwtracing-coresight: Fine-tuning for two function  implementations SF Markus Elfring <elfring@users.sourceforge.net> - 2017-04-27 21:50 +0200
    [PATCH 1/2] coresight-stm: Use devm_kcalloc() in stm_probe() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-04-27 21:50 +0200

#1632351 — [PATCH 0/2] hwtracing-coresight: Fine-tuning for two function implementations

FromSF Markus Elfring <elfring@users.sourceforge.net>
Date2017-04-27 21:50 +0200
Subject[PATCH 0/2] hwtracing-coresight: Fine-tuning for two function implementations
Message-ID<tAXAm-588-5@gated-at.bofh.it>
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Thu, 27 Apr 2017 21:34:32 +0200

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

Markus Elfring (2):
  Use devm_kcalloc() in stm_probe()
  Use devm_kcalloc() in of_coresight_alloc_memory()

 drivers/hwtracing/coresight/coresight-stm.c | 6 +++---
 drivers/hwtracing/coresight/of_coresight.c  | 6 +++---
 2 files changed, 6 insertions(+), 6 deletions(-)

-- 
2.12.2

[toc] | [next] | [standalone]


#1632352 — [PATCH 1/2] coresight-stm: Use devm_kcalloc() in stm_probe()

FromSF Markus Elfring <elfring@users.sourceforge.net>
Date2017-04-27 21:50 +0200
Subject[PATCH 1/2] coresight-stm: Use devm_kcalloc() in stm_probe()
Message-ID<tAXAm-588-13@gated-at.bofh.it>
In reply to#1632351
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Thu, 27 Apr 2017 21:18:57 +0200

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

  This issue was detected by using the Coccinelle software.

* Delete the local variable "bitmap_size" which became unnecessary
  with this refactoring.

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

diff --git a/drivers/hwtracing/coresight/coresight-stm.c b/drivers/hwtracing/coresight/coresight-stm.c
index 93fc26f01bab..bbb5275bf0d2 100644
--- a/drivers/hwtracing/coresight/coresight-stm.c
+++ b/drivers/hwtracing/coresight/coresight-stm.c
@@ -799,7 +799,7 @@ static int stm_probe(struct amba_device *adev, const struct amba_id *id)
 	struct stm_drvdata *drvdata;
 	struct resource *res = &adev->res;
 	struct resource ch_res;
-	size_t res_size, bitmap_size;
+	size_t res_size;
 	struct coresight_desc desc = { 0 };
 	struct device_node *np = adev->dev.of_node;
 
@@ -848,9 +848,9 @@ static int stm_probe(struct amba_device *adev, const struct amba_id *id)
 		res_size = min((resource_size_t)(drvdata->numsp *
 				 BYTES_PER_CHANNEL), resource_size(res));
 	}
-	bitmap_size = BITS_TO_LONGS(drvdata->numsp) * sizeof(long);
 
-	guaranteed = devm_kzalloc(dev, bitmap_size, GFP_KERNEL);
+	guaranteed = devm_kcalloc(dev, BITS_TO_LONGS(drvdata->numsp),
+				  sizeof(long), GFP_KERNEL);
 	if (!guaranteed)
 		return -ENOMEM;
 	drvdata->chs.guaranteed = guaranteed;
-- 
2.12.2

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web