Skip to content

Commit

Permalink
iommu/omap: Check for NULL in iopte_free()
Browse files Browse the repository at this point in the history
The iopte_free() function should check for NULL because
kmem_cache_free() will panic on NULL argument.

Signed-off-by: Zhouyi Zhou <yizhouzhou@ict.ac.cn>
Signed-off-by: Joerg Roedel <joro@8bytes.org>
  • Loading branch information
Zhouyi Zhou authored and Joerg Roedel committed Mar 5, 2014
1 parent 07a0203 commit e28045a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/iommu/omap-iommu.c
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,8 @@ static void flush_iopte_range(u32 *first, u32 *last)
static void iopte_free(u32 *iopte)
{
/* Note: freed iopte's must be clean ready for re-use */
kmem_cache_free(iopte_cachep, iopte);
if (iopte)
kmem_cache_free(iopte_cachep, iopte);
}

static u32 *iopte_alloc(struct omap_iommu *obj, u32 *iopgd, u32 da)
Expand Down

0 comments on commit e28045a

Please sign in to comment.