Commit 7878abde authored by Ajay Singh's avatar Ajay Singh Committed by Greg Kroah-Hartman

staging: wilc1000: refactor wilc_wlan_handle_isr_ext to avoid goto statement

Refactor wilc_wlan_handle_isr_ext() to avoid the use of the goto label.
Also avoid the unnecessary NULL check for 'wilc->rx_buffer' and
calling wilc_wlan_handle_rxq() only after wilc_wlan_rxq_add() call.
The link [1] contains details for discussion related to this changes.

[1]. https://patchwork.kernel.org/patch/10533601/Signed-off-by: default avatarAjay Singh <ajay.kathat@microchip.com>
Suggested-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 49328076
...@@ -815,31 +815,28 @@ static void wilc_wlan_handle_isr_ext(struct wilc *wilc, u32 int_status) ...@@ -815,31 +815,28 @@ static void wilc_wlan_handle_isr_ext(struct wilc *wilc, u32 int_status)
retries++; retries++;
} }
if (size > 0) { if (size <= 0)
if (LINUX_RX_SIZE - offset < size) return;
offset = 0;
if (wilc->rx_buffer) if (LINUX_RX_SIZE - offset < size)
buffer = &wilc->rx_buffer[offset]; offset = 0;
else
goto end; buffer = &wilc->rx_buffer[offset];
wilc->hif_func->hif_clear_int_ext(wilc, wilc->hif_func->hif_clear_int_ext(wilc, DATA_INT_CLR | ENABLE_RX_VMM);
DATA_INT_CLR | ENABLE_RX_VMM); ret = wilc->hif_func->hif_block_rx_ext(wilc, 0, buffer, size);
ret = wilc->hif_func->hif_block_rx_ext(wilc, 0, buffer, size); if (!ret)
return;
end:
if (ret) { offset += size;
offset += size; wilc->rx_buffer_offset = offset;
wilc->rx_buffer_offset = offset; rqe = kmalloc(sizeof(*rqe), GFP_KERNEL);
rqe = kmalloc(sizeof(*rqe), GFP_KERNEL); if (!rqe)
if (rqe) { return;
rqe->buffer = buffer;
rqe->buffer_size = size; rqe->buffer = buffer;
wilc_wlan_rxq_add(wilc, rqe); rqe->buffer_size = size;
} wilc_wlan_rxq_add(wilc, rqe);
}
}
wilc_wlan_handle_rxq(wilc); wilc_wlan_handle_rxq(wilc);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment