diff options
Diffstat (limited to 'drivers/staging/gdm72xx/gdm_sdio.c')
-rw-r--r-- | drivers/staging/gdm72xx/gdm_sdio.c | 37 |
1 files changed, 11 insertions, 26 deletions
diff --git a/drivers/staging/gdm72xx/gdm_sdio.c b/drivers/staging/gdm72xx/gdm_sdio.c index 3e43c012ef2..ca38d719a1f 100644 --- a/drivers/staging/gdm72xx/gdm_sdio.c +++ b/drivers/staging/gdm72xx/gdm_sdio.c @@ -60,27 +60,20 @@ static void hexdump(char *title, u8 *data, int len) static struct sdio_tx *alloc_tx_struct(struct tx_cxt *tx) { - struct sdio_tx *t = NULL; - - t = kmalloc(sizeof(*t), GFP_ATOMIC); - if (t == NULL) - goto out; + struct sdio_tx *t = kzalloc(sizeof(*t), GFP_ATOMIC); - memset(t, 0, sizeof(*t)); + if (!t) + return NULL; t->buf = kmalloc(TX_BUF_SIZE, GFP_ATOMIC); - if (t->buf == NULL) - goto out; + if (!t->buf) { + kfree(t); + return NULL; + } t->tx_cxt = tx; return t; -out: - if (t) { - kfree(t->buf); - kfree(t); - } - return NULL; } static void free_tx_struct(struct sdio_tx *t) @@ -93,20 +86,12 @@ static void free_tx_struct(struct sdio_tx *t) static struct sdio_rx *alloc_rx_struct(struct rx_cxt *rx) { - struct sdio_rx *r = NULL; + struct sdio_rx *r = kzalloc(sizeof(*r), GFP_ATOMIC); - r = kmalloc(sizeof(*r), GFP_ATOMIC); - if (r == NULL) - goto out; - - memset(r, 0, sizeof(*r)); - - r->rx_cxt = rx; + if (r) + r->rx_cxt = rx; return r; -out: - kfree(r); - return NULL; } static void free_rx_struct(struct sdio_rx *r) @@ -680,7 +665,7 @@ static int sdio_wimax_probe(struct sdio_func *func, phy_dev->rcv_func = gdm_sdio_receive; ret = init_sdio(sdev); - if (sdev < 0) + if (ret < 0) goto out; sdev->func = func; |