xen/arm: smmuv1: Switch from kzalloc_array(..) to devm_kcalloc(..)
authorRahul Singh <rahul.singh@arm.com>
Tue, 6 Jul 2021 10:53:59 +0000 (11:53 +0100)
committerJulien Grall <jgrall@amazon.com>
Wed, 7 Jul 2021 13:08:15 +0000 (14:08 +0100)
Switch from kzalloc_array(..) to devm_kcalloc(..) when allocating the
SMR to make code coherent.

Signed-off-by: Rahul Singh <rahul.singh@arm.com>
Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
Acked-by: Julien Grall <jgrall@amazon.com>
xen/drivers/passthrough/arm/smmu.c

index da2cd457d7b9b632bd42dff290c8b01aab7d70c1..658c40433c485a65a58e96f0933200e2351fd540 100644 (file)
@@ -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;