[PATCH 1/2] iommu/amd: Delete unnecessary NULL check

Dan Carpenter posted 2 patches 9 months ago
[PATCH 1/2] iommu/amd: Delete unnecessary NULL check
Posted by Dan Carpenter 9 months ago
The "iommu" pointer is always valid at this point so there is no
need to check for NULL.  Checking for NULL triggers a Smatch warning
because it's dereferenced without a check a couple lines later:

    drivers/iommu/amd/iommu.c:3200 alloc_irq_table()
    error: we previously assumed 'iommu' could be null (see line 3195)

Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
 drivers/iommu/amd/iommu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iommu/amd/iommu.c b/drivers/iommu/amd/iommu.c
index be8761bbef0f..ce2626801ddf 100644
--- a/drivers/iommu/amd/iommu.c
+++ b/drivers/iommu/amd/iommu.c
@@ -3192,7 +3192,7 @@ static struct irq_remap_table *alloc_irq_table(struct amd_iommu *iommu,
 	struct amd_iommu_pci_seg *pci_seg;
 	unsigned long flags;
 	int order = get_order(get_irq_table_size(max_irqs));
-	int nid = iommu && iommu->dev ? dev_to_node(&iommu->dev->dev) : NUMA_NO_NODE;
+	int nid = iommu->dev ? dev_to_node(&iommu->dev->dev) : NUMA_NO_NODE;
 	u16 alias;
 
 	spin_lock_irqsave(&iommu_table_lock, flags);
-- 
2.47.2