linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] coresight: Use devm_kcalloc() in coresight_alloc_conns()
@ 2020-07-27  1:50 Xu Wang
  2020-07-28 21:37 ` Mathieu Poirier
  0 siblings, 1 reply; 4+ messages in thread
From: Xu Wang @ 2020-07-27  1:50 UTC (permalink / raw)
  To: mathieu.poirier, suzuki.poulose, mike.leach, alexander.shishkin,
	linux-arm-kernel
  Cc: linux-kernel, Xu Wang

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

Signed-off-by: Xu Wang <vulab@iscas.ac.cn>
---
 drivers/hwtracing/coresight/coresight-platform.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/hwtracing/coresight/coresight-platform.c b/drivers/hwtracing/coresight/coresight-platform.c
index e4912abda3aa..d1460b6e4e07 100644
--- a/drivers/hwtracing/coresight/coresight-platform.c
+++ b/drivers/hwtracing/coresight/coresight-platform.c
@@ -27,7 +27,7 @@ static int coresight_alloc_conns(struct device *dev,
 				 struct coresight_platform_data *pdata)
 {
 	if (pdata->nr_outport) {
-		pdata->conns = devm_kzalloc(dev, pdata->nr_outport *
+		pdata->conns = devm_kcalloc(dev, pdata->nr_outport,
 					    sizeof(*pdata->conns),
 					    GFP_KERNEL);
 		if (!pdata->conns)
-- 
2.17.1


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

* Re: [PATCH] coresight: Use devm_kcalloc() in coresight_alloc_conns()
  2020-07-27  1:50 [PATCH] coresight: Use devm_kcalloc() in coresight_alloc_conns() Xu Wang
@ 2020-07-28 21:37 ` Mathieu Poirier
  0 siblings, 0 replies; 4+ messages in thread
From: Mathieu Poirier @ 2020-07-28 21:37 UTC (permalink / raw)
  To: Xu Wang
  Cc: Suzuki K. Poulose, Mike Leach, Alexander Shishkin,
	linux-arm-kernel, Linux Kernel Mailing List

On Sun, 26 Jul 2020 at 19:51, Xu Wang <vulab@iscas.ac.cn> wrote:
>
> 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".
>
> Signed-off-by: Xu Wang <vulab@iscas.ac.cn>
> ---
>  drivers/hwtracing/coresight/coresight-platform.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/hwtracing/coresight/coresight-platform.c b/drivers/hwtracing/coresight/coresight-platform.c
> index e4912abda3aa..d1460b6e4e07 100644
> --- a/drivers/hwtracing/coresight/coresight-platform.c
> +++ b/drivers/hwtracing/coresight/coresight-platform.c
> @@ -27,7 +27,7 @@ static int coresight_alloc_conns(struct device *dev,
>                                  struct coresight_platform_data *pdata)
>  {
>         if (pdata->nr_outport) {
> -               pdata->conns = devm_kzalloc(dev, pdata->nr_outport *
> +               pdata->conns = devm_kcalloc(dev, pdata->nr_outport,

https://lkml.org/lkml/2020/5/27/1098

>                                             sizeof(*pdata->conns),
>                                             GFP_KERNEL);
>                 if (!pdata->conns)
> --
> 2.17.1
>

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

* Re: [PATCH] coresight: Use devm_kcalloc() in coresight_alloc_conns()
  2020-05-26  5:52 Xu Wang
@ 2020-05-27 15:58 ` Mathieu Poirier
  0 siblings, 0 replies; 4+ messages in thread
From: Mathieu Poirier @ 2020-05-27 15:58 UTC (permalink / raw)
  To: Xu Wang
  Cc: Suzuki K. Poulose, Mike Leach, Alexander Shishkin,
	linux-arm-kernel, Linux Kernel Mailing List

On Mon, 25 May 2020 at 23:53, Xu Wang <vulab@iscas.ac.cn> wrote:
>
> 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".
>
> Signed-off-by: Xu Wang <vulab@iscas.ac.cn>
> ---
>  drivers/hwtracing/coresight/coresight-platform.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/hwtracing/coresight/coresight-platform.c b/drivers/hwtracing/coresight/coresight-platform.c
> index 43418a2126ff..6720049409f3 100644
> --- a/drivers/hwtracing/coresight/coresight-platform.c
> +++ b/drivers/hwtracing/coresight/coresight-platform.c
> @@ -27,9 +27,8 @@ static int coresight_alloc_conns(struct device *dev,
>                                  struct coresight_platform_data *pdata)
>  {
>         if (pdata->nr_outport) {
> -               pdata->conns = devm_kzalloc(dev, pdata->nr_outport *
> -                                           sizeof(*pdata->conns),
> -                                           GFP_KERNEL);
> +               pdata->conns = devm_kcalloc(dev, pdata->nr_outport,
> +                                           sizeof(*pdata->conns), GFP_KERNEL);

I have applied your patch.

Thanks,
Mathieu

>                 if (!pdata->conns)
>                         return -ENOMEM;
>         }
> --
> 2.17.1
>

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

* [PATCH] coresight: Use devm_kcalloc() in coresight_alloc_conns()
@ 2020-05-26  5:52 Xu Wang
  2020-05-27 15:58 ` Mathieu Poirier
  0 siblings, 1 reply; 4+ messages in thread
From: Xu Wang @ 2020-05-26  5:52 UTC (permalink / raw)
  To: mathieu.poirier, suzuki.poulose, mike.leach, alexander.shishkin
  Cc: linux-arm-kernel, linux-kernel

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

Signed-off-by: Xu Wang <vulab@iscas.ac.cn>
---
 drivers/hwtracing/coresight/coresight-platform.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/hwtracing/coresight/coresight-platform.c b/drivers/hwtracing/coresight/coresight-platform.c
index 43418a2126ff..6720049409f3 100644
--- a/drivers/hwtracing/coresight/coresight-platform.c
+++ b/drivers/hwtracing/coresight/coresight-platform.c
@@ -27,9 +27,8 @@ static int coresight_alloc_conns(struct device *dev,
 				 struct coresight_platform_data *pdata)
 {
 	if (pdata->nr_outport) {
-		pdata->conns = devm_kzalloc(dev, pdata->nr_outport *
-					    sizeof(*pdata->conns),
-					    GFP_KERNEL);
+		pdata->conns = devm_kcalloc(dev, pdata->nr_outport,
+					    sizeof(*pdata->conns), GFP_KERNEL);
 		if (!pdata->conns)
 			return -ENOMEM;
 	}
-- 
2.17.1


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

end of thread, other threads:[~2020-07-28 21:37 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-27  1:50 [PATCH] coresight: Use devm_kcalloc() in coresight_alloc_conns() Xu Wang
2020-07-28 21:37 ` Mathieu Poirier
  -- strict thread matches above, loose matches on Subject: below --
2020-05-26  5:52 Xu Wang
2020-05-27 15:58 ` Mathieu Poirier

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