[PATCH net-next v2] net: pse-pd: pd692x0: Return FW_UPLOAD_ERR_RW_ERROR on I2C send failure

From: Ian Rogers

Date: Fri Dec 04 2026 - 16:18:45 EST


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@xxxxxxxxxx>
---

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@xxxxxxxxxx

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