AMD IOMMU: don't BUG() when we don't have to

find_iommu_for_device() can easily return NULL instead, as all of its
callers are prepared for that.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
This commit is contained in:
Jan Beulich committed 2013-02-18 09:37:35 +01:00
1 parent 825ea023c1
commit f547d42ec0
1 file changed
+2 -2
+2 -2
View File
@@ -32,8 +32,8 @@ struct amd_iommu *find_iommu_for_device(int seg, int bdf)
{
struct ivrs_mappings *ivrs_mappings = get_ivrs_mappings(seg);
BUG_ON ( bdf >= ivrs_bdf_entries );
return ivrs_mappings ? ivrs_mappings[bdf].iommu : NULL;
return ivrs_mappings && bdf < ivrs_bdf_entries ? ivrs_mappings[bdf].iommu
: NULL;
}
/*
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.