Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e82936b3 authored by Susheel Khiani's avatar Susheel Khiani
Browse files

iommu: Add NULL pointer check in iommu_present function



We call msm_iommu_bus_register only when legacy
msm iommu driver is enabled. If for some reason
the driver is disabled, we never register our
dummy bus msm_iommu_non_sec_bus_type. So, we might
end up with NULL pointer exception if clients try
to call iommu_present with this dummy bus.

Put a NULL pointer check to ensure we don't end
up crashing system if legacy driver is disabled.

Change-Id: I7122e3355459e5115d639a8c1aab547bf0fc7f6e
Signed-off-by: default avatarSusheel Khiani <skhiani@codeaurora.org>
parent 05352690
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -882,6 +882,8 @@ EXPORT_SYMBOL_GPL(bus_set_iommu);

bool iommu_present(struct bus_type *bus)
{
	if (!bus)
		return false;
	return bus->iommu_ops != NULL;
}
EXPORT_SYMBOL_GPL(iommu_present);