wifi: wilc1000: Add proper error handling for remaining CMD52
Subsystems (3)
PATCH 1/1 wifi: wilc1000: Add proper error handling for remaining CMD52
A few of the CMD52 calls did not have any error handling, add it. This prevents odd errors like "Unexpected interrupt (1) int=nnn" when the CMD52 fails just above in the IRQ handler and the CMD52 error code is ignored by the driver. Fill the error handling in. Sort the variables in those affected functions while at it. Note that the error code itself is already printed in wilc_sdio_cmd52().
---
Cc: "David S. Miller" <[email protected]>
Cc: Adham Abozaeid <[email protected]>
Cc: Ajay Singh <[email protected]>
Cc: Alexis Lothoré <[email protected]>
Cc: Claudiu Beznea <[email protected]>
Cc: Conor Dooley <[email protected]>
Cc: Eric Dumazet <[email protected]>
Cc: Jakub Kicinski <[email protected]>
Cc: Kalle Valo <[email protected]>
Cc: Krzysztof Kozlowski <[email protected]>
Cc: Paolo Abeni <[email protected]>
Cc: Rob Herring <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
--- .../net/wireless/microchip/wilc1000/sdio.c | 27 ++++++++++++++----- 1 file changed, 21 insertions(+), 6 deletions(-)
drivers/net/wireless/microchip/wilc1000/sdio.c +21 -6
@@ -769,8 +769,10 @@ static int wilc_sdio_init(struct wilc *wilc, bool resume)static int wilc_sdio_read_size (struct wilc *wilc,u32 *size) { -u32 tmp; +struct sdio_func *func =dev_to_sdio_func (wilc->dev);struct sdio_cmd52 cmd; +u32 tmp; +int ret;/** * Read DMA count in words
@@ -780,12 +782,20 @@ static int wilc_sdio_read_size(struct wilc *wilc, u32 *size) cmd.raw =0 ; cmd.address =WILC_SDIO_INTERRUPT_DATA_SZ_REG ; cmd.data =0 ; -wilc_sdio_cmd52 (wilc, &cmd); + ret =wilc_sdio_cmd52 (wilc, &cmd); +if (ret) { +dev_err (&func->dev,"Fail cmd 52, set DATA_SZ[0] register...\n" ); +return ret; + } tmp = cmd.data; cmd.address =WILC_SDIO_INTERRUPT_DATA_SZ_REG +1 ; cmd.data =0 ; -wilc_sdio_cmd52 (wilc, &cmd); + ret =wilc_sdio_cmd52 (wilc, &cmd); +if (ret) { +dev_err (&func->dev,"Fail cmd 52, set DATA_SZ[1] register...\n" ); +return ret; + } tmp |= (cmd.data <<8 ); *size = tmp;
@@ -796,9 +806,10 @@ static int wilc_sdio_read_int(struct wilc *wilc, u32 *int_status) {struct sdio_func *func =dev_to_sdio_func (wilc->dev);struct wilc_sdio *sdio_priv = wilc->bus_data; -u32 tmp; -u8 irq_flags;struct sdio_cmd52 cmd; +u8 irq_flags; +u32 tmp; +int ret;wilc_sdio_read_size (wilc, &tmp);
@@ -817,7 +828,11 @@ static int wilc_sdio_read_int(struct wilc *wilc, u32 *int_status) cmd.raw =0 ; cmd.read_write =0 ; cmd.data =0 ; -wilc_sdio_cmd52 (wilc, &cmd); + ret =wilc_sdio_cmd52 (wilc, &cmd); +if (ret) { +dev_err (&func->dev,"Fail cmd 52, set IRQ_FLAG register...\n" ); +return ret; + } irq_flags = cmd.data;if (sdio_priv->irq_gpio)
Signature · 1 line
2.45.2
Hi Marek,
Quoted 45 lines · Marek Vasut
A few of the CMD52 calls did not have any error handling, add it. This prevents odd errors like "Unexpected interrupt (1) int=nnn" when the CMD52 fails just above in the IRQ handler and the CMD52 error code is ignored by the driver. Fill the error handling in. Sort the variables in those affected functions while at it. Note that the error code itself is already printed in
wilc_sdio_cmd52().Signed-off-by Marek Vasut <[email protected]>---
Cc: "David S. Miller" <[email protected]>
Cc: Adham Abozaeid <[email protected]>
Cc: Ajay Singh <[email protected]>
Cc: Alexis Lothoré <[email protected]>
Cc: Claudiu Beznea <[email protected]>
Cc: Conor Dooley <[email protected]>
Cc: Eric Dumazet <[email protected]>
Cc: Jakub Kicinski <[email protected]>
Cc: Kalle Valo <[email protected]>
Cc: Krzysztof Kozlowski <[email protected]>
Cc: Paolo Abeni <[email protected]>
Cc: Rob Herring <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]--- .../net/wireless/microchip/wilc1000/sdio.c | 27 ++++++++++++++----- 1 file changed, 21 insertions(+), 6 deletions(-)drivers/net/wireless/microchip/wilc1000/sdio.c +3
-1@@ -769,8 +769,10 @@ static int wilc_sdio_init(struct wilc *wilc, bool resume)static int wilc_sdio_read_size (struct wilc *wilc,u32 *size) { -u32 tmp; +struct sdio_func *func =dev_to_sdio_func (wilc->dev);struct sdio_cmd52 cmd; +u32 tmp; +int ret;/** * Read DMA count in words
drivers/net/wireless/microchip/wilc1000/sdio.c static int wilc_sdio_read_size(struct wilc *wilc, u32 *size) · line 787
Quoted 7 lines
drivers/net/wireless/microchip/wilc1000/sdio.c +3
-1@@ -780,12 +782,20 @@ static int wilc_sdio_read_size(struct wilc *wilc, u32 *size) cmd.raw =0 ; cmd.address =WILC_SDIO_INTERRUPT_DATA_SZ_REG ; cmd.data =0 ; -wilc_sdio_cmd52 (wilc, &cmd); + ret =wilc_sdio_cmd52 (wilc, &cmd); +if (ret) { +dev_err (&func->dev,"Fail cmd 52, set DATA_SZ[0] register...\n" );
I don't get the log message, why "set" DATA_SZ[0] ? This helper is rather trying to read it. Same for the other logs added below
Quoted 41 lines
drivers/net/wireless/microchip/wilc1000/sdio.c +15
-4+return ret; + } tmp = cmd.data; cmd.address =WILC_SDIO_INTERRUPT_DATA_SZ_REG +1 ; cmd.data =0 ; -wilc_sdio_cmd52 (wilc, &cmd); + ret =wilc_sdio_cmd52 (wilc, &cmd); +if (ret) { +dev_err (&func->dev,"Fail cmd 52, set DATA_SZ[1] register...\n" ); +return ret; + } tmp |= (cmd.data <<8 ); *size = tmp;@@ -796,9 +806,10 @@ static int wilc_sdio_read_int(struct wilc *wilc, u32 *int_status) {struct sdio_func *func =dev_to_sdio_func (wilc->dev);struct wilc_sdio *sdio_priv = wilc->bus_data; -u32 tmp; -u8 irq_flags;struct sdio_cmd52 cmd; +u8 irq_flags; +u32 tmp; +int ret;wilc_sdio_read_size (wilc, &tmp);@@ -817,7 +828,11 @@ static int wilc_sdio_read_int(struct wilc *wilc, u32 *int_status) cmd.raw =0 ; cmd.read_write =0 ; cmd.data =0 ; -wilc_sdio_cmd52 (wilc, &cmd); + ret =wilc_sdio_cmd52 (wilc, &cmd); +if (ret) { +dev_err (&func->dev,"Fail cmd 52, set IRQ_FLAG register...\n" ); +return ret; + } irq_flags = cmd.data;if (sdio_priv->irq_gpio)
Signature · 3 lines
Alexis Lothoré, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
On 10/22/24 11:11 AM, Alexis Lothoré wrote:
Hi,
Quoted 14 lines
Quoted 14 lines
drivers/net/wireless/microchip/wilc1000/sdio.c +3
-1@@ -769,8 +769,10 @@ static int wilc_sdio_init(struct wilc *wilc, bool resume)static int wilc_sdio_read_size (struct wilc *wilc,u32 *size) { -u32 tmp; +struct sdio_func *func =dev_to_sdio_func (wilc->dev);struct sdio_cmd52 cmd; +u32 tmp; +int ret;
Quoted 13 lines
drivers/net/wireless/microchip/wilc1000/sdio.c static int wilc_sdio_read_size(struct wilc *wilc, u32 *size) · line 787
Quoted 10 lines
drivers/net/wireless/microchip/wilc1000/sdio.c +3
-1/** * Read DMA count in words @@ -780,12 +782,20 @@ static int wilc_sdio_read_size(struct wilc *wilc, u32 *size) cmd.raw =0 ; cmd.address =WILC_SDIO_INTERRUPT_DATA_SZ_REG ; cmd.data =0 ; -wilc_sdio_cmd52 (wilc, &cmd); + ret =wilc_sdio_cmd52 (wilc, &cmd); +if (ret) { +dev_err (&func->dev,"Fail cmd 52, set DATA_SZ[0] register...\n" );I don't get the log message, why "set" DATA_SZ[0] ? This helper is rather trying to read it. Same for the other logs added below
Fixed in V2 , s@set@get@ , thanks !