lkml.org 
[lkml]   [2015]   [Jul]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRE: [PATCH] iwlwifi:Add increment statement for a for loop in the function iwl_pcie_rx_allocator
Date
> This removes the incrementing of the variable i at the end of the
> function iwl_pcie_rx_allocator's for loop into the for loop statement
> by adding the increment statement of i++ at the end of the for loop
> declaration in order to improve readablitiy of this for loop's
> declaration in the function iwl_pcie_rx_allocator.
>
> Signed-off-by: Nicholas Krause <xerofoify@gmail.com>
> ---
> drivers/net/wireless/iwlwifi/pcie/rx.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/net/wireless/iwlwifi/pcie/rx.c
> b/drivers/net/wireless/iwlwifi/pcie/rx.c
> index a3fbaa0..a26609c 100644
> --- a/drivers/net/wireless/iwlwifi/pcie/rx.c
> +++ b/drivers/net/wireless/iwlwifi/pcie/rx.c
> @@ -441,7 +441,7 @@ static void iwl_pcie_rx_allocator(struct iwl_trans
> *trans)
> list_replace_init(&rba->rbd_empty, &local_empty);
> spin_unlock(&rba->lock);
>
> - for (i = 0; i < RX_CLAIM_REQ_ALLOC;) {
> + for (i = 0; i < RX_CLAIM_REQ_ALLOC; i++) {
> struct iwl_rx_mem_buffer *rxb;
> struct page *page;
>

This is wrong in the error flows. Please note the continue statements in the code.
It is important that the loop counter will not be incremented in those cases, or your kernel will panic.

> @@ -478,7 +478,6 @@ static void iwl_pcie_rx_allocator(struct iwl_trans
> *trans)
>
> /* move the allocated entry to the out list */
> list_move(&rxb->list, &local_allocated);
> - i++;
> }
>
> spin_lock(&rba->lock);
> --
> 2.1.4

---------------------------------------------------------------------
A member of the Intel Corporation group of companies

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.



\
 
 \ /
  Last update: 2015-07-08 16:41    [W:0.053 / U:1.608 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site