On Tue, Sep 09, 2014 at 08:22:59AM -0400, nick wrote: > > > On 14-09-08 11:08 PM, nick wrote: > > I am attaching a trial patch again , please let me known if there are any issues for me to fix. > > Nick > > > This patch is wrong, checkpatch errors. I am attaching another fixed version. > Sorry 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. > lots of spelling mistake .. what is NuLl ? > 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_dequeue(&priv->rtllib->skb_waitQ[TXCMD_QUEUE]); again checkpatch warning of line over 80 char > + 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 _______________________________________________ Kernelnewbies mailing list Kernelnewbies@xxxxxxxxxxxxxxxxx http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies