On 14-09-09 12:40 PM, Valdis.Kletnieks@xxxxxx wrote: > On Tue, 09 Sep 2014 11:52:20 -0400, Nick Krause said: > >> I understand that , sorry Guys. I am going to fix this later including >> my spell checks. > > Don't bother. > Valdis, I am sending this in again fixed and working. I also looked at your complain about write_nic_byte and this seems to be there if this succeeds. Nick
>From 1d6378589ab97cc646e2a3717413077453e4e80b Mon Sep 17 00:00:00 2001 From: Nicholas Krause <xerofoify@xxxxxxxxx> Date: Mon, 8 Sep 2014 21:30:37 -0400 Subject: [PATCH] staging: Fix Null check for allocating skb in r8192E_firmware.c This patch checks in fw_download_code for if the allocated skb is NULl. Further more if the skb is null and we are in the loop, clean up and dequeune the skb quenue. In additon return false directly in the if statement and return true by itself removing rt_status to improve the code's readablitiy of return statements in fw_download_code. Signed-off-by: Nicholas Krause <xerofoify@xxxxxxxxx> --- drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c index 1a95d1f..6988e1c 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c @@ -36,7 +36,6 @@ static bool fw_download_code(struct net_device *dev, u8 *code_virtual_address, u32 buffer_len) { struct r8192_priv *priv = rtllib_priv(dev); - bool rt_status = true; u16 frag_threshold; u16 frag_length, frag_offset = 0; int i; @@ -61,6 +60,10 @@ static bool fw_download_code(struct net_device *dev, u8 *code_virtual_address, } skb = dev_alloc_skb(frag_length + 4); + if (skb == NULL) { + skb_queue_purge(&priv->rtllib->skb_waitQ[TXCMD_QUEUE]); + return false; + } memcpy((unsigned char *)(skb->cb), &dev, sizeof(dev)); tcb_desc = (struct cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE); tcb_desc->queue_index = TXCMD_QUEUE; @@ -99,7 +102,7 @@ static bool fw_download_code(struct net_device *dev, u8 *code_virtual_address, write_nic_byte(dev, TPPoll, TPPoll_CQ); - return rt_status; + return true; } static bool CPUcheck_maincodeok_turnonCPU(struct net_device *dev) -- 1.9.1
_______________________________________________ Kernelnewbies mailing list Kernelnewbies@xxxxxxxxxxxxxxxxx http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies