Commit 75bc5fad authored by Dan Carpenter's avatar Dan Carpenter Committed by Greg Kroah-Hartman

staging: gdm724x: cleanup alloc_tx_sdu_struct()

The kfree(t_sdu->buf) sets off a private static checker warning because
"t_sdu->buf" is always NULL.

This function just allocates two pointers so we can re-write it to be
simpler.
Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent a469fe1a
...@@ -119,28 +119,15 @@ static struct usb_tx *alloc_tx_struct(int len) ...@@ -119,28 +119,15 @@ static struct usb_tx *alloc_tx_struct(int len)
static struct usb_tx_sdu *alloc_tx_sdu_struct(void) static struct usb_tx_sdu *alloc_tx_sdu_struct(void)
{ {
struct usb_tx_sdu *t_sdu = NULL; struct usb_tx_sdu *t_sdu;
int ret = 0;
t_sdu = kzalloc(sizeof(struct usb_tx_sdu), GFP_ATOMIC); t_sdu = kzalloc(sizeof(struct usb_tx_sdu), GFP_ATOMIC);
if (!t_sdu) { if (!t_sdu)
ret = -ENOMEM; return NULL;
goto out;
}
t_sdu->buf = kmalloc(SDU_BUF_SIZE, GFP_ATOMIC); t_sdu->buf = kmalloc(SDU_BUF_SIZE, GFP_ATOMIC);
if (!t_sdu->buf) { if (!t_sdu->buf) {
ret = -ENOMEM; kfree(t_sdu);
goto out;
}
out:
if (ret < 0) {
if (t_sdu) {
kfree(t_sdu->buf);
kfree(t_sdu);
}
return NULL; return NULL;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment