diff options
author | Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> | 2013-12-17 21:18:49 +0400 |
---|---|---|
committer | Joerg Roedel <joro@8bytes.org> | 2014-01-07 18:35:25 +0400 |
commit | dc89f797abdbfc58dfb28af944f80f0299a8fafa (patch) | |
tree | 93b68a13f9026fa2bf3abda3fcf11ff749f23f0d | |
parent | 78a2e12f51d9ec37c328fa5a429c676eeeba8cd1 (diff) | |
download | linux-dc89f797abdbfc58dfb28af944f80f0299a8fafa.tar.xz |
iommu/shmobile: Allocate archdata with kzalloc()
The archdata attached_list field isn't initialized, leading to random
crashes when accessed. Use kzalloc() to allocate the whole structure and
make sure all fields get initialized properly.
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Joerg Roedel <joro@8bytes.org>
-rw-r--r-- | drivers/iommu/shmobile-iommu.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/iommu/shmobile-iommu.c b/drivers/iommu/shmobile-iommu.c index d572863dfccd..7a3b928fad1c 100644 --- a/drivers/iommu/shmobile-iommu.c +++ b/drivers/iommu/shmobile-iommu.c @@ -380,14 +380,13 @@ int ipmmu_iommu_init(struct shmobile_ipmmu *ipmmu) kmem_cache_destroy(l1cache); return -ENOMEM; } - archdata = kmalloc(sizeof(*archdata), GFP_KERNEL); + archdata = kzalloc(sizeof(*archdata), GFP_KERNEL); if (!archdata) { kmem_cache_destroy(l1cache); kmem_cache_destroy(l2cache); return -ENOMEM; } spin_lock_init(&archdata->attach_lock); - archdata->attached = NULL; archdata->ipmmu = ipmmu; ipmmu_archdata = archdata; bus_set_iommu(&platform_bus_type, &shmobile_iommu_ops); |