* [PATCH net-next v2] net: pse-pd: pd692x0: Return FW_UPLOAD_ERR_RW_ERROR on I2C send failure
@ 2026-12-04 21:18 Ian Rogers
0 siblings, 0 replies; only message in thread
From: Ian Rogers @ 2026-12-04 21:18 UTC (permalink / raw)
To: Oleksij Rempel, Kory Maincent, Andrew Lunn, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni
Cc: netdev, linux-kernel, llvm, Elkin Cruz, Ian Rogers
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
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-12-04 21:18 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-04 21:18 [PATCH net-next v2] net: pse-pd: pd692x0: Return FW_UPLOAD_ERR_RW_ERROR on I2C send failure Ian Rogers
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox