Staging: rtl8192su: check for skb == NULL

commit 199ef62a28 upstream.

added 2 checks for skb == NULL.
plus cosmetics

Signed-off-by: Florian Schilhabel <florian.c.schilhabel@googlemail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
[bwh: Remove cosmetic changes]
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
Florian Schilhabel
2010-05-04 14:23:43 +02:00
committed by Greg Kroah-Hartman
parent 276c429b5d
commit 0eec0208a1
2 changed files with 11 additions and 0 deletions

View File

@@ -68,6 +68,11 @@ bool FirmwareDownloadCode(struct net_device *dev, u8 * code_virtual_address,u32
/* Allocate skb buffer to contain firmware info and tx descriptor info. */
skb = dev_alloc_skb(frag_length);
if (skb == NULL) {
RT_TRACE(COMP_ERR, "(%s): unable to alloc skb buffer\n",
__func__);
goto cmdsend_downloadcode_fail;
}
memcpy((unsigned char *)(skb->cb),&dev,sizeof(dev));
tcb_desc = (cb_desc*)(skb->cb + MAX_DEV_ADDR_SIZE);

View File

@@ -56,6 +56,12 @@ SendTxCommandPacket(
//Get TCB and local buffer from common pool. (It is shared by CmdQ, MgntQ, and USB coalesce DataQ)
skb = dev_alloc_skb(USB_HWDESC_HEADER_LEN + DataLen + 4);
if (skb == NULL) {
RT_TRACE(COMP_ERR, "(%s): unable to alloc skb buffer\n",
__func__);
rtStatus = false;
return rtStatus;
}
memcpy((unsigned char *)(skb->cb),&dev,sizeof(dev));
tcb_desc = (cb_desc*)(skb->cb + MAX_DEV_ADDR_SIZE);
tcb_desc->queue_index = TXCMD_QUEUE;