iommu/msm: Add a check for the return of kzalloc()
authorXiaoke Wang <xkernel.wang@foxmail.com>
Thu, 28 Apr 2022 08:52:39 +0000 (16:52 +0800)
committerJoerg Roedel <jroedel@suse.de>
Thu, 28 Apr 2022 10:24:47 +0000 (12:24 +0200)
commitbb5bdc5ab7f133ba6fd32657d2ac90039c561e48
tree607433930f49e23ed9016a1222ba0accdb8802b1
parentaf2d861d4cd2a4da5137f795ee3509e6f944a25b
iommu/msm: Add a check for the return of kzalloc()

kzalloc() is a memory allocation function which can return NULL when
some internal memory errors happen. So it is better to check it to
prevent potential wrong memory access.

Besides, to propagate the error to the caller, the type of
insert_iommu_master() is changed to `int`. Several instructions related
to it are also updated.

Signed-off-by: Xiaoke Wang <xkernel.wang@foxmail.com>
Link: https://lore.kernel.org/r/tencent_EDB94B1C7E14B4E1974A66FF4D2029CC6D08@qq.com
Signed-off-by: Joerg Roedel <jroedel@suse.de>
drivers/iommu/msm_iommu.c