CHECK:ALLOC_SIZEOF_STRUCT: Prefer kzalloc(sizeof(*data)...) over 
kzalloc(sizeof(struct pamu_isr_data)...)
+       data = kzalloc(sizeof(struct pamu_isr_data), GFP_KERNEL);

CHECK:ALLOC_SIZEOF_STRUCT: Prefer kzalloc(sizeof(*dma_domain->win_arr)...) over 
kzalloc(sizeof(struct dma_window)...)
+               dma_domain->win_arr = kzalloc(sizeof(struct dma_window)

Signed-off-by: Emil Medve <emilian.me...@freescale.com>
---
 drivers/iommu/fsl_pamu.c        | 2 +-
 drivers/iommu/fsl_pamu_domain.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/iommu/fsl_pamu.c b/drivers/iommu/fsl_pamu.c
index 7f0181c..4f1926b 100644
--- a/drivers/iommu/fsl_pamu.c
+++ b/drivers/iommu/fsl_pamu.c
@@ -1039,7 +1039,7 @@ static int __init fsl_pamu_probe(struct platform_device 
*pdev)
                goto error;
        }
 
-       data = kzalloc(sizeof(struct pamu_isr_data), GFP_KERNEL);
+       data = kzalloc(sizeof(*data), GFP_KERNEL);
        if (!data) {
                dev_err(&pdev->dev, "PAMU isr data memory allocation failed\n");
                ret = -ENOMEM;
diff --git a/drivers/iommu/fsl_pamu_domain.c b/drivers/iommu/fsl_pamu_domain.c
index d5137dd..9417207 100644
--- a/drivers/iommu/fsl_pamu_domain.c
+++ b/drivers/iommu/fsl_pamu_domain.c
@@ -1037,7 +1037,7 @@ static int fsl_pamu_set_windows(struct iommu_domain 
*domain, u32 w_count)
                                ((w_count > 1) ? w_count : 0));
        if (!ret) {
                kfree(dma_domain->win_arr);
-               dma_domain->win_arr = kzalloc(sizeof(struct dma_window) *
+               dma_domain->win_arr = kzalloc(sizeof(*dma_domain->win_arr) *
                                                          w_count, GFP_ATOMIC);
                if (!dma_domain->win_arr) {
                        spin_unlock_irqrestore(&dma_domain->domain_lock, flags);
-- 
2.2.2

_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

Reply via email to