xen/arm: smmuv1: Switch from kzalloc_array(..) to devm_kcalloc(..)
PATCH 1/1 xen/arm: smmuv1: Switch from kzalloc_array(..) to devm_kcalloc(..)
Switch from kzalloc_array(..) to devm_kcalloc(..) when allocating the SMR to make code coherent.
Signed-off-by Rahul Singh <[email protected]>
--- xen/drivers/passthrough/arm/smmu.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
xen/drivers/passthrough/arm/smmu.c +4 -2
@@ -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 ;
Signature · 1 line
2.17.1
Hi Rahul,
Quoted 6 lines · Rahul Singh
Switch from
kzalloc_array(..)todevm_kcalloc(..)when allocating the SMR to make code coherent.Signed-off-by Rahul Singh <[email protected]>
Reviewed-by Bertrand Marquis <[email protected]>
Cheers
Bertrand
Quoted 31 lines
---
xen/drivers/passthrough/arm/smmu.c| 6 ++++--1 file changed, 4 insertions(+), 2 deletions(-)xen/drivers/passthrough/arm/smmu.c +4
-2@@ -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 ;Signature · 1 line
2.17.1
Hi Rahul,
Quoted 4 lines · Rahul Singh
Switch from
kzalloc_array(..)todevm_kcalloc(..)when allocating the SMR to make code coherent.Signed-off-by Rahul Singh <[email protected]>
Acked-by Julien Grall <[email protected]>
Cheers,
Signature · 1 line
Julien Grall
Quoted 9 lines · Julien Grall
Hi Rahul,
Quoted 4 lines · Rahul Singh
Switch from
kzalloc_array(..)todevm_kcalloc(..)when allocating the SMR to make code coherent.Signed-off-by Rahul Singh <[email protected]>Acked-by Julien Grall <[email protected]>
And committed.
Cheers,
Signature · 1 line
Julien Grall