All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mark Rutland <mark.rutland@arm.com>
To: SF Markus Elfring <elfring@users.sourceforge.net>
Cc: Ingo Molnar <mingo@kernel.org>, Pawel Moll <pawel.moll@arm.com>,
	Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
	"Suzuki K. Poulose" <suzuki.poulose@arm.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	LKML <linux-kernel@vger.kernel.org>,
	kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] bus: arm-ccn: Use devm_kcalloc() in arm_ccn_probe()
Date: Wed, 19 Apr 2017 08:23:18 +0000	[thread overview]
Message-ID: <20170419082317.GA27829@leverpostej> (raw)
In-Reply-To: <3458009f-6489-da7f-c1c1-c834d5b9d41d@users.sourceforge.net>

On Wed, Apr 19, 2017 at 09:29:24AM +0200, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Wed, 19 Apr 2017 09:12:43 +0200
> 
> Multiplications for the size determination of memory allocations
> indicated that array data structures should be processed.
> Thus use the corresponding function "devm_kcalloc".
> 
> This issue was detected by using the Coccinelle software.
> 
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>

This looks reasonable to me. FWIW:

Acked-by: Mark Rutland <mark.rutland@arm.com>

I'll leave the final say to Pawel.

Mark.

> ---
>  drivers/bus/arm-ccn.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/bus/arm-ccn.c b/drivers/bus/arm-ccn.c
> index 4d6a2b7e4d3f..6375bda0b2a1 100644
> --- a/drivers/bus/arm-ccn.c
> +++ b/drivers/bus/arm-ccn.c
> @@ -1520,10 +1520,10 @@ static int arm_ccn_probe(struct platform_device *pdev)
>  	if (err)
>  		return err;
>  
> -	ccn->node = devm_kzalloc(ccn->dev, sizeof(*ccn->node) * ccn->num_nodes,
> -		GFP_KERNEL);
> -	ccn->xp = devm_kzalloc(ccn->dev, sizeof(*ccn->node) * ccn->num_xps,
> -		GFP_KERNEL);
> +	ccn->node = devm_kcalloc(ccn->dev, ccn->num_nodes, sizeof(*ccn->node),
> +				 GFP_KERNEL);
> +	ccn->xp = devm_kcalloc(ccn->dev, ccn->num_xps, sizeof(*ccn->node),
> +			       GFP_KERNEL);
>  	if (!ccn->node || !ccn->xp)
>  		return -ENOMEM;
>  
> -- 
> 2.12.2
> 

WARNING: multiple messages have this Message-ID (diff)
From: Mark Rutland <mark.rutland@arm.com>
To: SF Markus Elfring <elfring@users.sourceforge.net>
Cc: Ingo Molnar <mingo@kernel.org>, Pawel Moll <pawel.moll@arm.com>,
	Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
	"Suzuki K. Poulose" <suzuki.poulose@arm.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	LKML <linux-kernel@vger.kernel.org>,
	kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] bus: arm-ccn: Use devm_kcalloc() in arm_ccn_probe()
Date: Wed, 19 Apr 2017 09:23:18 +0100	[thread overview]
Message-ID: <20170419082317.GA27829@leverpostej> (raw)
In-Reply-To: <3458009f-6489-da7f-c1c1-c834d5b9d41d@users.sourceforge.net>

On Wed, Apr 19, 2017 at 09:29:24AM +0200, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Wed, 19 Apr 2017 09:12:43 +0200
> 
> Multiplications for the size determination of memory allocations
> indicated that array data structures should be processed.
> Thus use the corresponding function "devm_kcalloc".
> 
> This issue was detected by using the Coccinelle software.
> 
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>

This looks reasonable to me. FWIW:

Acked-by: Mark Rutland <mark.rutland@arm.com>

I'll leave the final say to Pawel.

Mark.

> ---
>  drivers/bus/arm-ccn.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/bus/arm-ccn.c b/drivers/bus/arm-ccn.c
> index 4d6a2b7e4d3f..6375bda0b2a1 100644
> --- a/drivers/bus/arm-ccn.c
> +++ b/drivers/bus/arm-ccn.c
> @@ -1520,10 +1520,10 @@ static int arm_ccn_probe(struct platform_device *pdev)
>  	if (err)
>  		return err;
>  
> -	ccn->node = devm_kzalloc(ccn->dev, sizeof(*ccn->node) * ccn->num_nodes,
> -		GFP_KERNEL);
> -	ccn->xp = devm_kzalloc(ccn->dev, sizeof(*ccn->node) * ccn->num_xps,
> -		GFP_KERNEL);
> +	ccn->node = devm_kcalloc(ccn->dev, ccn->num_nodes, sizeof(*ccn->node),
> +				 GFP_KERNEL);
> +	ccn->xp = devm_kcalloc(ccn->dev, ccn->num_xps, sizeof(*ccn->node),
> +			       GFP_KERNEL);
>  	if (!ccn->node || !ccn->xp)
>  		return -ENOMEM;
>  
> -- 
> 2.12.2
> 

  reply	other threads:[~2017-04-19  8:23 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-19  7:29 [PATCH] bus: arm-ccn: Use devm_kcalloc() in arm_ccn_probe() SF Markus Elfring
2017-04-19  7:29 ` SF Markus Elfring
2017-04-19  8:23 ` Mark Rutland [this message]
2017-04-19  8:23   ` Mark Rutland
2017-04-19 13:04 ` Pawel Moll
2017-04-19 13:04   ` Pawel Moll

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170419082317.GA27829@leverpostej \
    --to=mark.rutland@arm.com \
    --cc=bigeasy@linutronix.de \
    --cc=elfring@users.sourceforge.net \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=pawel.moll@arm.com \
    --cc=suzuki.poulose@arm.com \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.