Skip to contentSkip to conversation

iommu/intel: Use logical OR operator for privilege mode check

PATCH Applied lirongqing 2 participants 2 messages Jun 5 – Jul 27

Subsystems (2)
lore
Share & tools
lore

lirongqing

author
#0 lore raw

PATCH 1/1 iommu/intel: Use logical OR operator for privilege mode check

From: Li RongQing <[email protected]>

Replace bitwise OR (|) with logical OR (||) in the privilege mode validation check. While both operators produce the same result for boolean values (0 or 1), using logical OR is semantically correct and makes the intent clearer.

No functional change, but improves code readability.

---
 drivers/iommu/intel/prq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iommu/intel/prq.c +1 -1
index adf2bab..b89184a 100644
@@ -223,7 +223,7 @@ static irqreturn_t prq_event_thread(int irq, void *d)
 			goto prq_advance;
 		}
 
-		if (unlikely(req->pm_req && (req->rd_req | req->wr_req))) {
+		if (unlikely(req->pm_req && (req->rd_req || req->wr_req))) {
 			pr_err("IOMMU: %s: Page request in Privilege Mode\n",
 			       iommu->name);
 			goto bad_req;
Signature · 1 line
2.9.4
maintainer Applied
#1 lore raw
Quoted 7 lines · lirongqing

From: Li RongQing<[email protected]>

Replace bitwise OR (|) with logical OR (||) in the privilege mode validation check. While both operators produce the same result for boolean values (0 or 1), using logical OR is semantically correct and makes the intent clearer.

Quoted 6 lines

No functional change, but improves code readability.

---
  drivers/iommu/intel/prq.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

Queued for v7.3-rc1. Thanks a lot.