Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

iommu/riscv: Simplify maximum determination in riscv_iommu_init_check()

Reduce nested max() calls by a single max3() call in this
function implementation.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Link: https://patch.msgid.link/d1a384c9-f154-4537-94d6-c3613f4167bc@web.de
Signed-off-by: Paul Walmsley <pjw@kernel.org>

authored by

Markus Elfring and committed by
Paul Walmsley
3127718a 5bfb2878

+4 -4
+4 -4
drivers/iommu/riscv/iommu.c
··· 1593 1593 FIELD_PREP(RISCV_IOMMU_ICVEC_PMIV, 3 % iommu->irqs_count); 1594 1594 riscv_iommu_writeq(iommu, RISCV_IOMMU_REG_ICVEC, iommu->icvec); 1595 1595 iommu->icvec = riscv_iommu_readq(iommu, RISCV_IOMMU_REG_ICVEC); 1596 - if (max(max(FIELD_GET(RISCV_IOMMU_ICVEC_CIV, iommu->icvec), 1597 - FIELD_GET(RISCV_IOMMU_ICVEC_FIV, iommu->icvec)), 1598 - max(FIELD_GET(RISCV_IOMMU_ICVEC_PIV, iommu->icvec), 1599 - FIELD_GET(RISCV_IOMMU_ICVEC_PMIV, iommu->icvec))) >= iommu->irqs_count) 1596 + if (max3(FIELD_GET(RISCV_IOMMU_ICVEC_CIV, iommu->icvec), 1597 + FIELD_GET(RISCV_IOMMU_ICVEC_FIV, iommu->icvec), 1598 + max(FIELD_GET(RISCV_IOMMU_ICVEC_PIV, iommu->icvec), 1599 + FIELD_GET(RISCV_IOMMU_ICVEC_PMIV, iommu->icvec))) >= iommu->irqs_count) 1600 1600 return -EINVAL; 1601 1601 1602 1602 return 0;