[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20251113160356.GN1949330@google.com>
Date: Thu, 13 Nov 2025 16:03:56 +0000
From: Lee Jones <lee@...nel.org>
To: Heiko Stuebner <heiko@...ech.de>
Cc: linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 4/4] mfd: qnap-mcu: Add proper error handling for
command errors
On Thu, 06 Nov 2025, Heiko Stuebner wrote:
> Further investigation revealed that the MCU in QNAP devices may return
> two error states. One "@8" for a checksum error in the submitted command
> and one "@9" for any generic (and sadly unspecified) error.
>
> These error codes with 2 data character can of course also be shorter
> then the expected reply length for the submitted command, so we'll
> need to check the received data for error codes and exit the receive
> portion early in that case.
>
> Signed-off-by: Heiko Stuebner <heiko@...ech.de>
> ---
> drivers/mfd/qnap-mcu.c | 65 +++++++++++++++++++++++++++++++++++++++++-
> 1 file changed, 64 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/mfd/qnap-mcu.c b/drivers/mfd/qnap-mcu.c
> index cd836bdd44a8..8c5eb4a72829 100644
> --- a/drivers/mfd/qnap-mcu.c
> +++ b/drivers/mfd/qnap-mcu.c
> @@ -19,6 +19,7 @@
> /* The longest command found so far is 5 bytes long */
> #define QNAP_MCU_MAX_CMD_SIZE 5
> #define QNAP_MCU_MAX_DATA_SIZE 36
> +#define QNAP_MCU_ERROR_SIZE 2
> #define QNAP_MCU_CHECKSUM_SIZE 1
>
> #define QNAP_MCU_RX_BUFFER_SIZE \
> @@ -103,6 +104,47 @@ static int qnap_mcu_write(struct qnap_mcu *mcu, const u8 *data, u8 data_size)
> return serdev_device_write(mcu->serdev, tx, length, HZ);
> }
>
> +static bool qnap_mcu_is_error_msg(size_t size) {
Looks like you forgot to run checkpatch.pl.
> + return (size == QNAP_MCU_ERROR_SIZE + QNAP_MCU_CHECKSUM_SIZE);
> +}
[...]
--
Lee Jones [李琼斯]
Powered by blists - more mailing lists