mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@linaro.org>
To: Joerg Roedel <joro@8bytes.org>
Cc: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>,
	Will Deacon <will@kernel.org>,
	Robin Murphy <robin.murphy@arm.com>,
	iommu@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: [PATCH 1/2] iommu/amd: Delete unnecessary NULL check
Date: Mon, 17 Mar 2025 09:43:08 +0300	[thread overview]
Message-ID: <d9e17a6f-a8f3-4272-91b6-0ee7e7808c8c@stanley.mountain> (raw)
In-Reply-To: <960a6d1a-63d6-49e8-890c-5e8a66e50c45@stanley.mountain>

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


  reply	other threads:[~2025-03-17  6:43 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-17  6:42 [PATCH 0/2] iommu/amd: two tiny cleanups Dan Carpenter
2025-03-17  6:43 ` Dan Carpenter [this message]
2025-03-17  6:43 ` [PATCH 2/2] iommu/amd: Return a literal in init_gcr3_table() Dan Carpenter
2025-03-20  8:03   ` Joerg Roedel
2025-03-20  8:53     ` Dan Carpenter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d9e17a6f-a8f3-4272-91b6-0ee7e7808c8c@stanley.mountain \
    --to=dan.carpenter@linaro.org \
    --cc=iommu@lists.linux.dev \
    --cc=joro@8bytes.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=robin.murphy@arm.com \
    --cc=suravee.suthikulpanit@amd.com \
    --cc=will@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®