From: Ilias Apalodimas <ilias.apalodimas@linaro.org>
To: netdev@vger.kernel.org, jaswinder.singh@linaro.org,
ard.biesheuvel@linaro.org
Cc: masami.hiramatsu@linaro.org, masahisa.kojima@linaro.org,
brouer@redhat.com, arnd@arndb.de,
Ilias Apalodimas <ilias.apalodimas@linaro.org>
Subject: [net-next, PATCH 2/2] net: socionext: refactor netsec_alloc_dring()
Date: Thu, 8 Nov 2018 17:19:55 +0200 [thread overview]
Message-ID: <1541690395-8337-2-git-send-email-ilias.apalodimas@linaro.org> (raw)
In-Reply-To: <1541690395-8337-1-git-send-email-ilias.apalodimas@linaro.org>
return -ENOMEM directly instead of assigning it in a variable
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
---
drivers/net/ethernet/socionext/netsec.c | 11 +++--------
1 file changed, 3 insertions(+), 8 deletions(-)
diff --git a/drivers/net/ethernet/socionext/netsec.c b/drivers/net/ethernet/socionext/netsec.c
index 9d24f29..bba9733 100644
--- a/drivers/net/ethernet/socionext/netsec.c
+++ b/drivers/net/ethernet/socionext/netsec.c
@@ -996,26 +996,21 @@ static void netsec_free_dring(struct netsec_priv *priv, int id)
static int netsec_alloc_dring(struct netsec_priv *priv, enum ring_id id)
{
struct netsec_desc_ring *dring = &priv->desc_ring[id];
- int ret = 0;
dring->vaddr = dma_zalloc_coherent(priv->dev, DESC_SZ * DESC_NUM,
&dring->desc_dma, GFP_KERNEL);
- if (!dring->vaddr) {
- ret = -ENOMEM;
+ if (!dring->vaddr)
goto err;
- }
dring->desc = kcalloc(DESC_NUM, sizeof(*dring->desc), GFP_KERNEL);
- if (!dring->desc) {
- ret = -ENOMEM;
+ if (!dring->desc)
goto err;
- }
return 0;
err:
netsec_free_dring(priv, id);
- return ret;
+ return -ENOMEM;
}
static int netsec_setup_rx_dring(struct netsec_priv *priv)
--
2.7.4
next prev parent reply other threads:[~2018-11-09 0:56 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-08 15:19 [net-next, PATCH 1/2] net: socionext: different approach on DMA Ilias Apalodimas
2018-11-08 15:19 ` Ilias Apalodimas [this message]
2018-11-09 3:43 ` [net-next, PATCH 2/2] net: socionext: refactor netsec_alloc_dring() David Miller
2018-11-09 3:42 ` [net-next, PATCH 1/2] net: socionext: different approach on DMA David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1541690395-8337-2-git-send-email-ilias.apalodimas@linaro.org \
--to=ilias.apalodimas@linaro.org \
--cc=ard.biesheuvel@linaro.org \
--cc=arnd@arndb.de \
--cc=brouer@redhat.com \
--cc=jaswinder.singh@linaro.org \
--cc=masahisa.kojima@linaro.org \
--cc=masami.hiramatsu@linaro.org \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).