[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] xen/arm: smmuv1: Switch from kzalloc_array(..) to devm_kcalloc(..)
- To: Rahul Singh <Rahul.Singh@xxxxxxx>
- From: Bertrand Marquis <Bertrand.Marquis@xxxxxxx>
- Date: Tue, 6 Jul 2021 17:09:06 +0000
- Accept-language: en-GB, en-US
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=qJ9cftBAebo4tPMCdQCthkL6pet0xRYEw/nEmrkHaf0=; b=f1U4rp2vnRxRpnEIEljdaFZMSVmLMgxWCFP6TkrWjB83ruZgToPeBhvhnnE3vtYoBcH25d9LI3vEYHo2ts0t5RMclrG2dhvBs9Btx5PZCEQQsBcw6te16Tc2hcL+SAfrz+5hFnAGtDI4roUhNb0hfuQIze9yzZX+vyNRVp7oQNuJ9oTWpJWwpN5jIRzINRVxUDX+zbmTepCJ7wUIY8I5t5vbDuAKV47AlfZpb1pXCCR701R6cLO2jTtISixO3w9dfbP02XWA79JiDsvRcSXxQVdK44l2L4HcYSriOkECsJUE283ccSIWRUW9IsB2JsGOb8k1GnX7RjJAq00yXBjrbg==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=aJqxZ9XqWFY2oh7CX2jtrTwjqbTa5+X5hv6hGWU03w6eI63DLE7csNeufRuYl2UM+FX2kuVT2NBZArOc9m+O8879heyXyBQBJPI8eKVwuBkOtnp2+KqrBy8eD+jfIiv/8ATAyIkBSdblzA9iXgHc6xePs1w1JnjDXs4KW+u7MtuK/6RD4A7McfYMSMdLBv2GzU/KhS0FElyygGUnfmhKxQfG1IPHti2ABgjiixq2Sv7Nv7pHTMWi2zplSHn+kP1l4LAAmoyvvSVotZEI1nH4mwEkdmmTM0bR4x48gT29dR/qzPPlrSuMhVM/Zj3HqYLR09KAIB4kLuntQjzn1RLNSA==
- Authentication-results-original: arm.com; dkim=none (message not signed) header.d=none;arm.com; dmarc=none action=none header.from=arm.com;
- Cc: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
- Delivery-date: Tue, 06 Jul 2021 17:09:43 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
- Nodisclaimer: true
- Original-authentication-results: arm.com; dkim=none (message not signed) header.d=none;arm.com; dmarc=none action=none header.from=arm.com;
- Thread-index: AQHXclVEDxOOzv0NIEKGiChMKv1YoKs2LpKA
- Thread-topic: [PATCH] xen/arm: smmuv1: Switch from kzalloc_array(..) to devm_kcalloc(..)
Hi Rahul,
> On 6 Jul 2021, at 11:53, Rahul Singh <Rahul.Singh@xxxxxxx> wrote:
>
> Switch from kzalloc_array(..) to devm_kcalloc(..) when allocating the
> SMR to make code coherent.
>
> Signed-off-by: Rahul Singh <rahul.singh@xxxxxxx>
Reviewed-by: Bertrand Marquis <bertrand.marquis@xxxxxxx>
Cheers
Bertrand
> ---
> xen/drivers/passthrough/arm/smmu.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/xen/drivers/passthrough/arm/smmu.c
> b/xen/drivers/passthrough/arm/smmu.c
> index da2cd457d7..658c40433c 100644
> --- a/xen/drivers/passthrough/arm/smmu.c
> +++ b/xen/drivers/passthrough/arm/smmu.c
> @@ -149,7 +149,8 @@ typedef enum irqreturn irqreturn_t;
> #define kzalloc(size, flags) _xzalloc(size, sizeof(void *))
> #define devm_kzalloc(dev, size, flags) _xzalloc(size, sizeof(void *))
> #define kmalloc_array(size, n, flags) _xmalloc_array(size, sizeof(void *), n)
> -#define kzalloc_array(size, n, flags) _xzalloc_array(size,
> sizeof(void *), n)
> +#define devm_kcalloc(dev, n, size, flags) \
> + _xzalloc_array(size, sizeof(void *), n)
>
> static void __iomem *devm_ioremap_resource(struct device *dev,
> struct resource *res)
> @@ -2222,7 +2223,8 @@ static int arm_smmu_device_cfg_probe(struct
> arm_smmu_device *smmu)
> smmu->smr_mask_mask = smr >> SMR_MASK_SHIFT;
>
> /* Zero-initialised to mark as invalid */
> - smmu->smrs = kzalloc_array(sizeof(*smmu->smrs), size,
> GFP_KERNEL);
> + smmu->smrs = devm_kcalloc(smmu->dev, size, sizeof(*smmu->smrs),
> + GFP_KERNEL);
> if (!smmu->smrs)
> return -ENOMEM;
>
> --
> 2.17.1
>
|