iommu/amd: Remove redundant devid checks
Checking the return value of get_device_id() in a code-path which has already done check_device() is not needed, as check_device() does the same check and bails out if it fails. Signed-off-by: Joerg Roedel <jroedel@suse.de> Reviewed-by: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com> Link: https://lore.kernel.org/r/20200527115313.7426-11-joro@8bytes.org
This commit is contained in:
parent
05a0542b45
commit
736c3333e3
|
@ -413,13 +413,8 @@ static void iommu_ignore_device(struct device *dev)
|
||||||
static void amd_iommu_uninit_device(struct device *dev)
|
static void amd_iommu_uninit_device(struct device *dev)
|
||||||
{
|
{
|
||||||
struct iommu_dev_data *dev_data;
|
struct iommu_dev_data *dev_data;
|
||||||
int devid;
|
|
||||||
|
|
||||||
devid = get_device_id(dev);
|
dev_data = dev_iommu_priv_get(dev);
|
||||||
if (devid < 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
dev_data = search_dev_data(devid);
|
|
||||||
if (!dev_data)
|
if (!dev_data)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -2173,16 +2168,12 @@ static void amd_iommu_probe_finalize(struct device *dev)
|
||||||
|
|
||||||
static void amd_iommu_release_device(struct device *dev)
|
static void amd_iommu_release_device(struct device *dev)
|
||||||
{
|
{
|
||||||
|
int devid = get_device_id(dev);
|
||||||
struct amd_iommu *iommu;
|
struct amd_iommu *iommu;
|
||||||
int devid;
|
|
||||||
|
|
||||||
if (!check_device(dev))
|
if (!check_device(dev))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
devid = get_device_id(dev);
|
|
||||||
if (devid < 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
iommu = amd_iommu_rlookup_table[devid];
|
iommu = amd_iommu_rlookup_table[devid];
|
||||||
|
|
||||||
amd_iommu_uninit_device(dev);
|
amd_iommu_uninit_device(dev);
|
||||||
|
|
Loading…
Reference in New Issue