lkml.org 
[lkml]   [2012]   [Mar]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    Subject[ 030/108] rtlwifi: Handle previous allocation failures when freeing device memory
    3.0-stable review patch.  If anyone has any objections, please let me know.

    ------------------

    From: Simon Graham <simon.graham@virtualcomputer.com>

    commit 7f66c2f93e5779625c10d262c84537427a2673ca upstream.

    Handle previous allocation failures when freeing device memory

    Signed-off-by: Simon Graham <simon.graham@virtualcomputer.com>
    Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
    Signed-off-by: John W. Linville <linville@tuxdriver.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

    ---
    drivers/net/wireless/rtlwifi/pci.c | 16 ++++++++++------
    1 file changed, 10 insertions(+), 6 deletions(-)

    --- a/drivers/net/wireless/rtlwifi/pci.c
    +++ b/drivers/net/wireless/rtlwifi/pci.c
    @@ -1180,10 +1180,12 @@ static void _rtl_pci_free_tx_ring(struct
    ring->idx = (ring->idx + 1) % ring->entries;
    }

    - pci_free_consistent(rtlpci->pdev,
    - sizeof(*ring->desc) * ring->entries,
    - ring->desc, ring->dma);
    - ring->desc = NULL;
    + if (ring->desc) {
    + pci_free_consistent(rtlpci->pdev,
    + sizeof(*ring->desc) * ring->entries,
    + ring->desc, ring->dma);
    + ring->desc = NULL;
    + }
    }

    static void _rtl_pci_free_rx_ring(struct rtl_pci *rtlpci)
    @@ -1207,12 +1209,14 @@ static void _rtl_pci_free_rx_ring(struct
    kfree_skb(skb);
    }

    - pci_free_consistent(rtlpci->pdev,
    + if (rtlpci->rx_ring[rx_queue_idx].desc) {
    + pci_free_consistent(rtlpci->pdev,
    sizeof(*rtlpci->rx_ring[rx_queue_idx].
    desc) * rtlpci->rxringcount,
    rtlpci->rx_ring[rx_queue_idx].desc,
    rtlpci->rx_ring[rx_queue_idx].dma);
    - rtlpci->rx_ring[rx_queue_idx].desc = NULL;
    + rtlpci->rx_ring[rx_queue_idx].desc = NULL;
    + }
    }
    }




    \
     
     \ /
      Last update: 2012-03-30 23:07    [W:0.040 / U:2.264 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site