[PATCH] net/qed: allow old cards not supporting "num_images" to work

Louis Leseur posted 1 patch 1 year, 2 months ago
There is a newer version of this series
drivers/net/ethernet/qlogic/qed/qed_mcp.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
[PATCH] net/qed: allow old cards not supporting "num_images" to work
Posted by Louis Leseur 1 year, 2 months ago
Commit 43645ce03e0063d7c4a5001215ca815188778881 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.

We added a check to return EOPNOTSUPP when the card is not able to
return these information, allowing the driver continue instead of
returning an error.

Co-developed-by: Florian Forestier <florian@forestier.re>
Signed-off-by: Florian Forestier <florian@forestier.re>
Signed-off-by: Louis Leseur <louis.leseur@gmail.com>
---
 drivers/net/ethernet/qlogic/qed/qed_mcp.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/qlogic/qed/qed_mcp.c b/drivers/net/ethernet/qlogic/qed/qed_mcp.c
index 16e6bd466143..6218d9c26855 100644
--- a/drivers/net/ethernet/qlogic/qed/qed_mcp.c
+++ b/drivers/net/ethernet/qlogic/qed/qed_mcp.c
@@ -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;
-- 
2.45.2
Re: [PATCH] net/qed: allow old cards not supporting "num_images" to work
Posted by Paolo Abeni 1 year, 2 months ago
On 11/21/24 18:26, Louis Leseur wrote:
> Commit 43645ce03e0063d7c4a5001215ca815188778881 added support for

Please use the following format to reference an exiting commit:

commit <first 12 chars from commit hash> ("<commit title>")

> 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.
> 
> We added a check to return EOPNOTSUPP when the card is not able to
> return these information, allowing the driver continue instead of
> returning an error.
> 
> Co-developed-by: Florian Forestier <florian@forestier.re>
> Signed-off-by: Florian Forestier <florian@forestier.re>
> Signed-off-by: Louis Leseur <louis.leseur@gmail.com>

This is a fix, as such it should target the 'net' tree in the subj
prefix and should include a suitable Fixes tag.

See:

https://elixir.bootlin.com/linux/v6.12/source/Documentation/process/maintainer-netdev.rst

for the details.

Since you have to repost, I suggest re-phrasing the last paragraph,
noting that the caller already handle EOPNOTSUPP without failing, and
using imperative mood.

Thanks,

Paolo