The pointer mode is used then checked which is a bug reported by PVS studio and Coverity.
Fixes: bd2fd34ab86f ("common/cnxk: sync eth mode change command with firmware") Cc: tduszyn...@marvell.com Signed-off-by: Stephen Hemminger <step...@networkplumber.org> --- drivers/common/cnxk/roc_bphy_cgx.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/common/cnxk/roc_bphy_cgx.c b/drivers/common/cnxk/roc_bphy_cgx.c index 4f43605e10..6e5cfc7b1d 100644 --- a/drivers/common/cnxk/roc_bphy_cgx.c +++ b/drivers/common/cnxk/roc_bphy_cgx.c @@ -369,20 +369,20 @@ roc_bphy_cgx_set_link_mode(struct roc_bphy_cgx *roc_cgx, unsigned int lmac, { uint64_t scr1, scr0; + if (!mode) + return -EINVAL; + + if (!roc_cgx) + return -EINVAL; + if (roc_model_is_cn9k() && (mode->use_portm_idx || mode->portm_idx || mode->mode_group_idx)) { return -ENOTSUP; } - if (!roc_cgx) - return -EINVAL; - if (!roc_bphy_cgx_lmac_exists(roc_cgx, lmac)) return -ENODEV; - if (!mode) - return -EINVAL; - scr1 = FIELD_PREP(SCR1_ETH_CMD_ID, ETH_CMD_MODE_CHANGE) | FIELD_PREP(SCR1_ETH_MODE_CHANGE_ARGS_SPEED, mode->speed) | FIELD_PREP(SCR1_ETH_MODE_CHANGE_ARGS_DUPLEX, mode->full_duplex) | -- 2.45.2