diff mbox series

coresight: Use devm_kcalloc() in coresight_alloc_conns()

Message ID 20200526055241.2671-1-vulab@iscas.ac.cn (mailing list archive)
State Mainlined
Commit 870fdd851ca50ffa552c41fd127afafceb303eca
Headers show
Series coresight: Use devm_kcalloc() in coresight_alloc_conns() | expand

Commit Message

Xu Wang May 26, 2020, 5:52 a.m. UTC
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(-)

Comments

Mathieu Poirier May 27, 2020, 3:58 p.m. UTC | #1
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
>
diff mbox series

Patch

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;
 	}