* [patch] staging: gdm724x: cleanup alloc_tx_sdu_struct()
@ 2014-02-18 12:18 Dan Carpenter
0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2014-02-18 12:18 UTC (permalink / raw)
To: kernel-janitors
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: Dan Carpenter <dan.carpenter@oracle.com>
diff --git a/drivers/staging/gdm724x/gdm_usb.c b/drivers/staging/gdm724x/gdm_usb.c
index 33458a583142..03b43056fcf2 100644
--- a/drivers/staging/gdm724x/gdm_usb.c
+++ b/drivers/staging/gdm724x/gdm_usb.c
@@ -119,28 +119,15 @@ out:
static struct usb_tx_sdu *alloc_tx_sdu_struct(void)
{
- struct usb_tx_sdu *t_sdu = NULL;
- int ret = 0;
-
+ struct usb_tx_sdu *t_sdu;
t_sdu = kzalloc(sizeof(struct usb_tx_sdu), GFP_ATOMIC);
- if (!t_sdu) {
- ret = -ENOMEM;
- goto out;
- }
+ if (!t_sdu)
+ return NULL;
t_sdu->buf = kmalloc(SDU_BUF_SIZE, GFP_ATOMIC);
if (!t_sdu->buf) {
- ret = -ENOMEM;
- goto out;
- }
-out:
-
- if (ret < 0) {
- if (t_sdu) {
- kfree(t_sdu->buf);
- kfree(t_sdu);
- }
+ kfree(t_sdu);
return NULL;
}
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2014-02-18 12:18 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-02-18 12:18 [patch] staging: gdm724x: cleanup alloc_tx_sdu_struct() Dan Carpenter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox