[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CANLsYkxU-Srbu+-GT13cVfUqjE4GOGhtkxZgKfxGz+P=n1BB7A@mail.gmail.com>
Date: Wed, 27 May 2020 09:58:04 -0600
From: Mathieu Poirier <mathieu.poirier@...aro.org>
To: Xu Wang <vulab@...as.ac.cn>
Cc: "Suzuki K. Poulose" <suzuki.poulose@....com>,
Mike Leach <mike.leach@...aro.org>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
linux-arm-kernel <linux-arm-kernel@...ts.infradead.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] coresight: Use devm_kcalloc() in coresight_alloc_conns()
On Mon, 25 May 2020 at 23:53, Xu Wang <vulab@...as.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@...as.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
>
Powered by blists - more mailing lists