Skip to content

Commit

Permalink
net/qed: allow old cards not supporting "num_images" to work
Browse files Browse the repository at this point in the history
[ Upstream commit 7a0ea70 ]

Commit 43645ce ("qed: Populate nvm image attribute shadow.")
added support for populating flash image attributes, notably
"num_images". However, some cards were not able to return this
information. In such cases, the driver would return EINVAL, causing the
driver to exit.

Add check to return EOPNOTSUPP instead of EINVAL when the card is not
able to return these information. The caller function already handles
EOPNOTSUPP without error.

Fixes: 43645ce ("qed: Populate nvm image attribute shadow.")
Co-developed-by: Florian Forestier <[email protected]>
Signed-off-by: Florian Forestier <[email protected]>
Signed-off-by: Louis Leseur <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Paolo Abeni <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
  • Loading branch information
teapot9 authored and gregkh committed Dec 14, 2024
1 parent 6f0ae06 commit 5e1c91f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/net/ethernet/qlogic/qed/qed_mcp.c
Original file line number Diff line number Diff line change
Expand Up @@ -3314,7 +3314,9 @@ int qed_mcp_bist_nvm_get_num_images(struct qed_hwfn *p_hwfn,
if (rc)
return rc;

if (((rsp & FW_MSG_CODE_MASK) != FW_MSG_CODE_OK))
if (((rsp & FW_MSG_CODE_MASK) == FW_MSG_CODE_UNSUPPORTED))
rc = -EOPNOTSUPP;
else if (((rsp & FW_MSG_CODE_MASK) != FW_MSG_CODE_OK))
rc = -EINVAL;

return rc;
Expand Down

0 comments on commit 5e1c91f

Please sign in to comment.