[PATCH 03/12] ethernet: octeon_ep: Use min() to improve code

Qianfeng Rong posted 12 patches 3 months ago
[PATCH 03/12] ethernet: octeon_ep: Use min() to improve code
Posted by Qianfeng Rong 3 months ago
Use min() to reduce the code and improve its readability.

Signed-off-by: Qianfeng Rong <rongqianfeng@vivo.com>
---
 drivers/net/ethernet/marvell/octeon_ep/octep_pfvf_mbox.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/marvell/octeon_ep/octep_pfvf_mbox.c b/drivers/net/ethernet/marvell/octeon_ep/octep_pfvf_mbox.c
index ebecdd29f3bd..cfae09bf6fea 100644
--- a/drivers/net/ethernet/marvell/octeon_ep/octep_pfvf_mbox.c
+++ b/drivers/net/ethernet/marvell/octeon_ep/octep_pfvf_mbox.c
@@ -39,10 +39,7 @@ static void octep_pfvf_validate_version(struct octep_device *oct,  u32 vf_id,
 
 	dev_dbg(&oct->pdev->dev, "VF id:%d VF version:%d PF version:%d\n",
 		vf_id, vf_version, OCTEP_PFVF_MBOX_VERSION_CURRENT);
-	if (vf_version < OCTEP_PFVF_MBOX_VERSION_CURRENT)
-		rsp->s_version.version = vf_version;
-	else
-		rsp->s_version.version = OCTEP_PFVF_MBOX_VERSION_CURRENT;
+	rsp->s_version.version = min(vf_version, OCTEP_PFVF_MBOX_VERSION_CURRENT);
 
 	oct->vf_info[vf_id].mbox_version = rsp->s_version.version;
 	dev_dbg(&oct->pdev->dev, "VF id:%d negotiated VF version:%d\n",
-- 
2.34.1