Skip to content

Commit 736c333

Browse files
committed
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 <[email protected]> Reviewed-by: Suravee Suthikulpanit <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 05a0542 commit 736c333

File tree

1 file changed

+2
-11
lines changed

1 file changed

+2
-11
lines changed

drivers/iommu/amd_iommu.c

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -413,13 +413,8 @@ static void iommu_ignore_device(struct device *dev)
413413
static void amd_iommu_uninit_device(struct device *dev)
414414
{
415415
struct iommu_dev_data *dev_data;
416-
int devid;
417-
418-
devid = get_device_id(dev);
419-
if (devid < 0)
420-
return;
421416

422-
dev_data = search_dev_data(devid);
417+
dev_data = dev_iommu_priv_get(dev);
423418
if (!dev_data)
424419
return;
425420

@@ -2173,16 +2168,12 @@ static void amd_iommu_probe_finalize(struct device *dev)
21732168

21742169
static void amd_iommu_release_device(struct device *dev)
21752170
{
2171+
int devid = get_device_id(dev);
21762172
struct amd_iommu *iommu;
2177-
int devid;
21782173

21792174
if (!check_device(dev))
21802175
return;
21812176

2182-
devid = get_device_id(dev);
2183-
if (devid < 0)
2184-
return;
2185-
21862177
iommu = amd_iommu_rlookup_table[devid];
21872178

21882179
amd_iommu_uninit_device(dev);

0 commit comments

Comments
 (0)