hv:vtd: fix MISRA-C violations on pointer not checked for null before use
This patch fix MISRA-C violations in arch/x86/vtd.c
on Pointer not checked for null before use.
Acked-by: Anthony Xu
@@ -992,6 +992,9 @@ static void do_action_for_iommus(void (*action)(struct dmar_drhd_rt *))
struct dmar_drhd_rt *dmar_unit;
uint32_t i;
+ if (info == NULL) {
+ pr_fatal("%s: can't find dmar info\n", __func__);
+ } else {
for (i = 0U; i < info->drhd_count; i++) {
dmar_unit = &dmar_drhd_units[i];
if (!dmar_unit->drhd->ignore) {
@@ -1001,6 +1004,7 @@ static void do_action_for_iommus(void (*action)(struct dmar_drhd_rt *))
}
}
}
+}
struct iommu_domain *create_iommu_domain(uint16_t vm_id, uint64_t translation_table, uint32_t addr_width)
{
