Re: [net-next PATCH v3 1/2] octeontx2-af: correct __iomem annotations flagged by Sparse

From: Andrew Lunn
Date: Tue Mar 11 2025 - 17:22:37 EST


> if (mbox->mbox.hwbase)
> - iounmap(mbox->mbox.hwbase);
> + iounmap((void __iomem *)mbox->mbox.hwbase);

This looks wrong. If you are unmapping it, you must of mapped it
somewhere. And that mapping would of returned an __iomem value. So
mbox.hwbase should be an __iomem value and you would not need this
cast.

> for (qidx = 0; qidx < pf->qset.cq_cnt; qidx++) {
> - ptr = otx2_get_regaddr(pf, NIX_LF_CQ_OP_INT);
> + ptr = (__force u64 *)otx2_get_regaddr(pf, NIX_LF_CQ_OP_INT);
> val = otx2_atomic64_add((qidx << 44), ptr);

This also looks questionable. You should be removing casts, not adding
them. otx2_get_regaddr() returns an __iomem. So maybe
otx2_atomic64_add() is actually broken here?

Andrew

---
pw-bot: cr