@@ -808,6 +808,7 @@ static int wilc_sdio_read_int(struct wilc *wilc, u32 *int_status)
u32 tmp;
u8 irq_flags;
struct sdio_cmd52 cmd;
+ int ret;
wilc_sdio_read_size(wilc, &tmp);
@@ -826,7 +827,12 @@ 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, get IRQ register...\n");
+ return ret;
+ }
+
irq_flags = cmd.data;
if (sdio_priv->irq_gpio)
The wilc_sdio_read_init() calls wilc_sdio_cmd52() but does not check the return value. This could lead to execution with potentially invalid data if wilc_sdio_cmd52() fails. A proper implementation can be found in wilc_sdio_read_reg(). Add error handling for wilc_sdio_cmd52(). If wilc_sdio_cmd52() fails, log an error message via dev_err(). Fixes: eda308be643f ("staging: wilc1000: refactor interrupt handling for sdio") Cc: stable@vger.kernel.org # v5.7 Signed-off-by: Wentao Liang <vulab@iscas.ac.cn> --- v2: Fix code error. drivers/net/wireless/microchip/wilc1000/sdio.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)