Message ID | 20220427160635.420492-4-jakobkoschel@gmail.com (mailing list archive) |
---|---|
State | Handled Elsewhere, archived |
Headers | show
Return-Path: <linuxppc-dev-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org> X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=UamABqmz; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ozlabs.org (client-ip=2404:9400:2:0:216:3eff:fee1:b9f1; helo=lists.ozlabs.org; envelope-from=linuxppc-dev-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org; receiver=<UNKNOWN>) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2404:9400:2:0:216:3eff:fee1:b9f1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4KpNwm5LdMz9s5V for <incoming@patchwork.ozlabs.org>; Thu, 28 Apr 2022 02:09:12 +1000 (AEST) Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4KpNwm46zYz3bgV for <incoming@patchwork.ozlabs.org>; Thu, 28 Apr 2022 02:09:12 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=UamABqmz; dkim-atps=neutral X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gmail.com (client-ip=2a00:1450:4864:20::52c; helo=mail-ed1-x52c.google.com; envelope-from=jakobkoschel@gmail.com; receiver=<UNKNOWN>) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=UamABqmz; dkim-atps=neutral Received: from mail-ed1-x52c.google.com (mail-ed1-x52c.google.com [IPv6:2a00:1450:4864:20::52c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4KpNtd3ZKLz3bYM for <linuxppc-dev@lists.ozlabs.org>; Thu, 28 Apr 2022 02:07:21 +1000 (AEST) Received: by mail-ed1-x52c.google.com with SMTP id g23so2477764edy.13 for <linuxppc-dev@lists.ozlabs.org>; Wed, 27 Apr 2022 09:07:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=fEe777jf21mNuBLYmQSjDhGs0vKSqwrqRu+k2WAlJJI=; b=UamABqmz85uwD6pNa9ppky+li2Rl66SIvHGPZAkZVVplDfguBN2gvzOkJOhaiRqNGo w4fvmZjgVfGNJF5AOxd1tcte4r2cbB7t/uoyu4KztE/vthdmIXv5I6UY49yp1+DYS7Xh 9j/TlXjAQ2gDG8dwmHMyRfHk1Kw64P83QqoqtW05BXmUo7o/LsgKDe8SC8J+Sghxk4zd 335vq71ir8P7aETUROxG1BwEZox7dWCMHuxGLLBDs7zGmUOfhUYMOY+X+cEaRcJgk1PB GzHiotygYFSraZoVwVsqkjC3NHG10ku3IkPGBiw38mQdLc4oh1SaC8DmzpJzLf5WJ73Y AhTw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=fEe777jf21mNuBLYmQSjDhGs0vKSqwrqRu+k2WAlJJI=; b=urc/t+o/WK2HPHL1lolnESUq96NTa0m2921hxc/08etZFMLOtpH6yTWOlRAhBLFnUf cM9FUTvceGJH1Ebt6/svlq7P4olRAxx8HL6PhNlVCbft6mKjxdQxxGwknvVSlm3+7+px rtXVgDxy6Lps8po1uubB0diYWq01FEWzwTgZWuy1lwFVtBooN3MXMU0yJGy4D14Un+NN aWh1q30TKiuRz+Bq0I4k5ETr7PDOVnL4cBjYxe/+HkrFaruB03qQUwIIUmFQiIY9g9LV c+o+THEvokhcUegsUNe3tia4MABjRvdl1AP9V4NquxqVOT/manWX6fCImQyM+Kq1aEmL CSXQ== X-Gm-Message-State: AOAM532ZXQszNKz49hdfgeSzJ1gmqkdwSowEgFw+4VVnq+ojX6MR2cIY UevAAaWqAoa27Oq+I/uAgnA= X-Google-Smtp-Source: ABdhPJySlXKZf47ps6kDqshs4fRxCzYc+L5zpCq3TvKUZGNFin1KNz+UcjSbrxBlctSBknb4gNbpAw== X-Received: by 2002:aa7:dd45:0:b0:425:8cea:8c76 with SMTP id o5-20020aa7dd45000000b004258cea8c76mr30819280edw.353.1651075637990; Wed, 27 Apr 2022 09:07:17 -0700 (PDT) Received: from localhost.localdomain (i130160.upc-i.chello.nl. [62.195.130.160]) by smtp.googlemail.com with ESMTPSA id n5-20020a170906378500b006efb4ab6f59sm6984098ejc.86.2022.04.27.09.07.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Apr 2022 09:07:17 -0700 (PDT) From: Jakob Koschel <jakobkoschel@gmail.com> To: "David S. Miller" <davem@davemloft.net> Subject: [PATCH net-next v5 03/18] net: dsa: sja1105: reorder sja1105_first_entry_longer_than with memory allocation Date: Wed, 27 Apr 2022 18:06:20 +0200 Message-Id: <20220427160635.420492-4-jakobkoschel@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220427160635.420492-1-jakobkoschel@gmail.com> References: <20220427160635.420492-1-jakobkoschel@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List <linuxppc-dev.lists.ozlabs.org> List-Unsubscribe: <https://lists.ozlabs.org/options/linuxppc-dev>, <mailto:linuxppc-dev-request@lists.ozlabs.org?subject=unsubscribe> List-Archive: <http://lists.ozlabs.org/pipermail/linuxppc-dev/> List-Post: <mailto:linuxppc-dev@lists.ozlabs.org> List-Help: <mailto:linuxppc-dev-request@lists.ozlabs.org?subject=help> List-Subscribe: <https://lists.ozlabs.org/listinfo/linuxppc-dev>, <mailto:linuxppc-dev-request@lists.ozlabs.org?subject=subscribe> Cc: Andrew Lunn <andrew@lunn.ch>, Song Liu <songliubraving@fb.com>, Alexei Starovoitov <ast@kernel.org>, Eric Dumazet <edumazet@google.com>, Paul Mackerras <paulus@samba.org>, Ariel Elior <aelior@marvell.com>, Florian Fainelli <f.fainelli@gmail.com>, Daniel Borkmann <daniel@iogearbox.net>, Steen Hegelund <Steen.Hegelund@microchip.com>, John Fastabend <john.fastabend@gmail.com>, Andrii Nakryiko <andrii@kernel.org>, "Bos, H.J." <h.j.bos@vu.nl>, Jason Gunthorpe <jgg@ziepe.ca>, linux-arm-kernel@lists.infradead.org, Vladimir Oltean <vladimir.oltean@nxp.com>, Martin Habets <habetsm.xilinx@gmail.com>, Paolo Abeni <pabeni@redhat.com>, Vivien Didelot <vivien.didelot@gmail.com>, Jiri Pirko <jiri@resnulli.us>, Arnd Bergmann <arnd@arndb.de>, KP Singh <kpsingh@kernel.org>, Christophe JAILLET <christophe.jaillet@wanadoo.fr>, Jakob Koschel <jakobkoschel@gmail.com>, Jakub Kicinski <kuba@kernel.org>, Brian Johannesmeyer <bjohannesmeyer@gmail.com>, Lars Povlsen <lars.povlsen@microchip.com>, Colin Ian King <colin.king@intel.com>, Manish Chopra <manishc@marvell.com>, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, UNGLinuxDriver@microchip.com, Yonghong Song <yhs@fb.com>, Edward Cree <ecree.xilinx@gmail.com>, Casper Andersson <casper.casan@gmail.com>, Xu Wang <vulab@iscas.ac.cn>, Cristiano Giuffrida <c.giuffrida@vu.nl>, bpf@vger.kernel.org, Vladimir Oltean <olteanv@gmail.com>, linuxppc-dev@lists.ozlabs.org, Martin KaFai Lau <kafai@fb.com>, Mike Rapoport <rppt@kernel.org> Errors-To: linuxppc-dev-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" <linuxppc-dev-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org> |
Series |
Remove use of list iterator after loop body
|
expand
|
diff --git a/drivers/net/dsa/sja1105/sja1105_vl.c b/drivers/net/dsa/sja1105/sja1105_vl.c index 369be2ac3587..e5ea8eb9ec4e 100644 --- a/drivers/net/dsa/sja1105/sja1105_vl.c +++ b/drivers/net/dsa/sja1105/sja1105_vl.c @@ -36,7 +36,11 @@ static int sja1105_insert_gate_entry(struct sja1105_gating_config *gating_cfg, { struct sja1105_gate_entry *e; struct list_head *pos; - int rc; + + pos = sja1105_first_entry_longer_than(&gating_cfg->entries, + entry_time, extack); + if (IS_ERR(pos)) + return PTR_ERR(pos); e = kzalloc(sizeof(*e), GFP_KERNEL); if (!e) @@ -45,22 +49,11 @@ static int sja1105_insert_gate_entry(struct sja1105_gating_config *gating_cfg, e->rule = rule; e->gate_state = gate_state; e->interval = entry_time; - - pos = sja1105_first_entry_longer_than(&gating_cfg->entries, - e->interval, extack); - if (IS_ERR(pos)) { - rc = PTR_ERR(pos); - goto err; - } - list_add(&e->list, pos->prev); gating_cfg->num_entries++; return 0; -err: - kfree(e); - return rc; } /* The gate entries contain absolute times in their e->interval field. Convert