From: Ian Rogers <irogers@google.com>
To: Oleksij Rempel <o.rempel@pengutronix.de>,
Kory Maincent <kory.maincent@bootlin.com>,
Andrew Lunn <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@kernel.org>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
llvm@lists.linux.dev, Elkin Cruz <elkin@google.com>,
Ian Rogers <irogers@google.com>
Subject: [PATCH net-next v2] net: pse-pd: pd692x0: Return FW_UPLOAD_ERR_RW_ERROR on I2C send failure
Date: Fri, 4 Dec 2026 13:18:37 -0800 [thread overview]
Message-ID: <20261204211837.4039719-1-irogers@google.com> (raw)
pd692x0_fw_reset() and pd692x0_fw_write() both return enum fw_upload_err,
but return the raw negative errno from i2c_master_send() on two error
paths (sending "RST" and sending 'P'), unlike the other I2C error paths
in the same functions which return FW_UPLOAD_ERR_RW_ERROR.
Return FW_UPLOAD_ERR_RW_ERROR on both paths so the firmware upload core
receives a valid enum fw_upload_err and reports "read-write-error"
instead of logging an invalid error code and reporting "unknown-error".
Found with Clang's -Wimplicit-int-enum-cast on an x86_64 allyesconfig
build and confirmed by reading both functions; Gemini helped audit the
warning and draft the patch. The issue was not triggered at runtime and
the patch is compile-tested only (LLVM=1 W=1 -Werror) because PD692x0
hardware is not available.
Signed-off-by: Ian Rogers <irogers@google.com>
---
Notes:
v2:
- Target net-next and drop the Fixes tag (Kory Maincent).
- Restrict the patch to the two return statements in pd692x0_fw_reset()
and pd692x0_fw_write(), dropping the unrelated enum conversions and
pd692x0_fw_recv_resp() change (Kory Maincent).
- Simplify the commit message.
v1: https://lore.kernel.org/r/20261119171014.1534691-1-irogers@google.com
drivers/net/pse-pd/pd692x0.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/pse-pd/pd692x0.c b/drivers/net/pse-pd/pd692x0.c
index 667e0b818811..665c1aaea981 100644
--- a/drivers/net/pse-pd/pd692x0.c
+++ b/drivers/net/pse-pd/pd692x0.c
@@ -1524,7 +1524,7 @@ static enum fw_upload_err pd692x0_fw_reset(const struct i2c_client *client)
dev_err(&client->dev,
"Failed to reset the controller (%pe)\n",
ERR_PTR(ret));
- return ret;
+ return FW_UPLOAD_ERR_RW_ERROR;
}
timeout = msecs_to_jiffies(10000) + jiffies;
@@ -1660,7 +1660,7 @@ static enum fw_upload_err pd692x0_fw_write(struct fw_upload *fwl,
dev_err(&client->dev,
"Failed to boot programming mode (%pe)\n",
ERR_PTR(ret));
- return ret;
+ return FW_UPLOAD_ERR_RW_ERROR;
}
ret = pd692x0_fw_recv_resp(client, 100, "TOP\r\n", sizeof("TOP\r\n") - 1);
--
2.56.1.915.g69d5ec7298-goog
reply other threads:[~2026-12-04 21:18 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261204211837.4039719-1-irogers@google.com \
--to=irogers@google.com \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=elkin@google.com \
--cc=kory.maincent@bootlin.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=llvm@lists.linux.dev \
--cc=netdev@vger.kernel.org \
--cc=o.rempel@pengutronix.de \
--cc=pabeni@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox