From patchwork Thu Nov 8 15:19:55 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilias Apalodimas X-Patchwork-Id: 150529 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp946790ljp; Thu, 8 Nov 2018 07:20:06 -0800 (PST) X-Google-Smtp-Source: AJdET5cAvUhRTf2Ji66y9TKBqr8M4xANIakrvJv+k9tAMCoE/GLGlT7QxlCwr8VKTgRuemUwpRwY X-Received: by 2002:a17:902:9346:: with SMTP id g6-v6mr4825719plp.148.1541690406227; Thu, 08 Nov 2018 07:20:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541690406; cv=none; d=google.com; s=arc-20160816; b=dDnEGo0srsUWm/zt1JXKkphzPf9XskeVcfR8OF5Vr+32MJ2wVCSzZ/ILva86TfQJIK a84CswGWntE+iSv5o+JLKp2clQ3p+3Ot5iQoarLZ3ZHaLzuedZpVpNPagYSX2dt6v/fv AzO29ozO6LieR8PNX1rHGAYPaQwqtYVLwCGVnYxWFBRe4WaNpmdicPcbGt6OXob1JGex qkUTcbJoSBMKuCoIK6b6SXR9MkHqGZmlxW1Gvw3iVUIhWf/iiA36v9PtjYCN8qisjjyP oBdyB+c8F7EJQGJTn0udGFLcmF2HQzA7g9u9iiynEo4mluM+Wa/iXvnYcnn+0iqNA/vC YDJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=EeEfZdWz4Sz9cknFfQy1le2gNMBOFDGKE+QjghPi6fk=; b=ghANeqxuJhK3mhzSchvLKwuer6XZaYfRuSLosZ9yhXpeI7/s8+ISDWchq7E971t0tb 7DFJXe8rly8vuPQM8QDghNk04byffX3VXIX+UkgBFFzN8qzGV6GpBW1jInHVTsQ1jyVF U4xCOmcsAIno5okuWozc0PzBWLnuGJtHbVvmX36hMo7eg/uC22GWXKoR1LWpw61lzZUT pXE5kLB6ElpCkk1Av9Yxc2uAavr93Mu60+C25cd+A6dx+3aFNb6cpea27zI82fqGU7Qs xnk7W5CeUmfdMhP7xYaSS4Dh6s6aHdqXO489unHelcEXnQ94fwWCJURsqnPscN6I9eEP IFNg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=MeCRz6HS; spf=pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v4-v6si4319717plz.250.2018.11.08.07.20.05; Thu, 08 Nov 2018 07:20:06 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=MeCRz6HS; spf=pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727238AbeKIA4C (ORCPT + 10 others); Thu, 8 Nov 2018 19:56:02 -0500 Received: from mail-wr1-f66.google.com ([209.85.221.66]:40041 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727001AbeKIA4C (ORCPT ); Thu, 8 Nov 2018 19:56:02 -0500 Received: by mail-wr1-f66.google.com with SMTP id i17-v6so21665455wre.7 for ; Thu, 08 Nov 2018 07:20:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=EeEfZdWz4Sz9cknFfQy1le2gNMBOFDGKE+QjghPi6fk=; b=MeCRz6HS9P0Euwhustas4co/kju6dRdo9V9XpCbi3zBgEqG2wP2offgSF+nvhhwSjB oGNOxliiqBHqrZN3B+eL8fmqCoLb5nLPK+8FMrIllJp4VFdjC+2tMAPBf+x6b2/KZuBj 0GUyAagJP+s6RbjpGKpLgcLAxGBbxNJ7rqH9o= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=EeEfZdWz4Sz9cknFfQy1le2gNMBOFDGKE+QjghPi6fk=; b=qcJfQmC4ysJqUhybjrVmYYBBa0bGD5V4OfjF8hTtJS1SB1Lphl1pxux6WVng7613a+ EAg11iOGWjcviKMslPVo5QW4kPnKruY21TqBE+hEKc7MhrcSpV0+/WHshw+sKqdK5bjj atU5mqeDb6lW3bZTKnWyLQPmxrutnnpIKVPxCqCKSm6EoG0yfLh5zuwQ4g+JwyPnSuzF 0keL7aHqtc62+J0s+gSpyQ4jx6jPWg3Y0ZGnWdw6/uQRQnJvQows1iK9Y1nK1rSdKOY3 u8+7cZYdPM6r5UpY2I+NMlOvSS3kW9N8PXcqlpw+LimD9HVL5N+TXCQVKK3Or2d2N/92 3FTA== X-Gm-Message-State: AGRZ1gKmUoE4xah+YZAa7HB5Ztn6JF2Qq6SkYHl6LWWyu8658nn8UInp z0nMR6lYiVv6M4mNxrIfkajySjOgRvQDeA== X-Received: by 2002:adf:9326:: with SMTP id 35-v6mr4805852wro.318.1541690401681; Thu, 08 Nov 2018 07:20:01 -0800 (PST) Received: from apalos.lan (ppp-94-65-93-8.home.otenet.gr. [94.65.93.8]) by smtp.gmail.com with ESMTPSA id x139-v6sm2937764wme.3.2018.11.08.07.19.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 08 Nov 2018 07:20:00 -0800 (PST) From: Ilias Apalodimas 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 Subject: [net-next, PATCH 2/2] net: socionext: refactor netsec_alloc_dring() Date: Thu, 8 Nov 2018 17:19:55 +0200 Message-Id: <1541690395-8337-2-git-send-email-ilias.apalodimas@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1541690395-8337-1-git-send-email-ilias.apalodimas@linaro.org> References: <1541690395-8337-1-git-send-email-ilias.apalodimas@linaro.org> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org return -ENOMEM directly instead of assigning it in a variable Signed-off-by: Ilias Apalodimas --- drivers/net/ethernet/socionext/netsec.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) -- 2.7.4 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)