🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #3065

[PATCH net-next v3 5/7] net: mctp: usblib: Simplify allocation logic in mctp_usblib_test_rx_init

#3065
From: James Lee
Date: Wed, 14 Oct 2026 04:47
29 lines
6701 bytes
The if statement testing rx's allocation is unneeded.

Signed-off-by: James Lee <james@codeconstruct.com.au>
---
 drivers/net/mctp/mctp-usblib-test.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/net/mctp/mctp-usblib-test.c b/drivers/net/mctp/mctp-usblib-test.c
index ba2cd432355fe130a36d4f815c40ddb915db234a..4a8761618258dce08025fadc442c71f98e74026a 100644
--- a/drivers/net/mctp/mctp-usblib-test.c
+++ b/drivers/net/mctp/mctp-usblib-test.c
@@ -202,11 +202,9 @@ mctp_usblib_test_rx_init(struct kunit *test, bool span)
 	int rc;
 
 	rx = kzalloc_obj(*rx);
-	if (rx) {
-		rc = kunit_add_action_or_reset(test, action_rx_fini, rx);
-		KUNIT_ASSERT_EQ(test, rc, 0);
-	}
 	KUNIT_ASSERT_NOT_NULL(test, rx);
+	rc = kunit_add_action_or_reset(test, action_rx_fini, rx);
+	KUNIT_ASSERT_EQ(test, rc, 0);
 
 	rc = mctp_usblib_rx_init(rx, ep_maxpacket, span);
 	KUNIT_ASSERT_EQ(test, rc, 0);

-- 
2.47.3
Technical Details
Message-ID: <20261014-dev-mctp-usb-lib-test-v3-5-ee5bc3ea1db1@codeconstruct.com.au>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-346022-linux-kernel-netdev=dewy.ru
References: <20261014-dev-mctp-usb-lib-test-v3-0-ee5bc3ea1db1@codeconstruct.com.au>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-346022-linux-kernel-netdev=dewy.ru
From: james@codeconstruct.com.au (James Lee)
Newsgroups: linux.kernel.netdev
Subject: [PATCH net-next v3 5/7] net: mctp: usblib: Simplify allocation
 logic in mctp_usblib_test_rx_init
Date: Wed, 14 Oct 2026 12:47:35 +0800
Organization: Usenet Network
Message-ID: <20261014-dev-mctp-usb-lib-test-v3-5-ee5bc3ea1db1@codeconstruct.com.au>
References: <20261014-dev-mctp-usb-lib-test-v3-0-ee5bc3ea1db1@codeconstruct.com.au>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 7bit
Injection-Info: usenet.network;
	logging-data="2219139"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:0aOveDWCtqIgY0eg7mmJQ1bo7MI= sha256:SrzXFOC5aLKKkglDccmbWhGLlfF7x3g2Gtb8XWkgMr8=
	sha1:1fFWSRsKe1A3aGFyA21u+zTU2xg= sha256:TDHSg1aUWN2r4XwwSU10xr2ngZxDJJ5gn6mEkCP+p8I=
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id BBFAD10FFE8; Wed, 14 Oct 2026 07:53:27 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: 0.35
X-Spam-Status: No, score=0.35 tagged_above=-9999 required=6.31
	tests=[DCC_CHECK=1.1, DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1,
	DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,
	HEADER_FROM_DIFFERENT_DOMAINS=0.25, MAILING_LIST_MULTI=-1,
	SPF_HELO_NONE=0.001, SPF_PASS=-0.001] autolearn=no autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
	header.d=codeconstruct.com.au
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id 48HMmQroX6If;
	Wed, 14 Oct 2026 07:53:24 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-346022-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=codeconstruct.com.au
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
	by mail.dewy.ru (Postfix) with ESMTPS id 538C210FFE6; Wed, 14 Oct 2026 07:53:15 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.90.174.1])
	by sea.lore.kernel.org (Postfix) with ESMTP id 31A26418EA; Wed, 14 Oct 2026 04:48:13 +0000 (UTC)
X-Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id A44DA42464E;
	Wed, 14 Oct 2026 04:48:02 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=codeconstruct.com.au header.i=@codeconstruct.com.au header.b="ad/a7OpK"
X-Received: from codeconstruct.com.au (pi.codeconstruct.com.au [203.29.241.158])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0B6F141F376;
	Wed, 14 Oct 2026 04:48:00 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=203.29.241.158
X-ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
	t=1791953282; cv=none; b=R2DsczPaKi+EEOZjvZPqw4wsHpwq2RMHkXBejmWVfU2ifD8rbDG5L6GlG8EAqChAOEZuEL1RZuJDHb6hCk7ZB6kFK0M96Fi1GVWa5jaFbxDYf/vnWwBG/raKu7MYeitDm3ni+QwgJswi2eMKS5ZzMfqqALc9oUIXP5BNLB/WEDE=
X-ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org;
	s=arc-20240116; t=1791953282; c=relaxed/simple;
	bh=OHs8I4xAyy5uQDeBSzPDHM2x5Vxl3oJYkF5aB1g1rk4=;
	h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References:
	 In-Reply-To:To:Cc; b=J/r/N20dCCBXRNtVxFR6Hdx2F4aO9sM8cS/zkLKMXx/kr4ZipVYHjnCV3nCMm3hb24T/M1ZZKEvBYR6nzc5v0GKbJoL41FsvLAqUA9pCHMvhFq/LqPHxEuEIiZhYgtZ1r+dzmNlRdKPTcz0htH/XYIMJMxG2PsLeqTUEUKr42E4=
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=codeconstruct.com.au; spf=pass smtp.mailfrom=codeconstruct.com.au; dkim=pass (2048-bit key) header.d=codeconstruct.com.au header.i=@codeconstruct.com.au header.b=ad/a7OpK; arc=none smtp.client-ip=203.29.241.158
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=codeconstruct.com.au
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=codeconstruct.com.au
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
	d=codeconstruct.com.au; s=2022a; t=1791953277;
	bh=NP6KXnXaoPUg2fq+HmQndlOs7BOCfABbKwsn5QaRyeg=;
	h=From:Date:Subject:References:In-Reply-To:To:Cc;
	b=ad/a7OpKR73YpIq7oz/QK7u+qZMZABJ3lHU3NfylveejqTZrZgPn8Bewy/zdn2PvB
	 xYcwftknqrPmjmLtJfCNQS4xoYf1TjuXkeQXPQCIjRuqUY3v8zm2TI6q6DEMnpBFmy
	 29lLYt/s1Nfse1LyPttpRroFry8zG9hn17AGEj31BlWdhGL+EIupndFo7OJJRhXcsb
	 8orJ9ehmmOte2p/UM3LPZ3y7+47UrZAPJjpO2+sSxYY1nHXsaO8lP5Z1gsJ2HrOyWS
	 5nKFqv2Y+Jv6ejnIurI9vzfFk9JH+I1fAfDnjITstmnxe7pY4gCRFbiFG9J+1DQb02
	 v1UDrQHtvnnWg==
X-Received: by codeconstruct.com.au (Postfix, from userid 10004)
	id 0707B6FD58; Wed, 14 Oct 2026 12:47:57 +0800 (AWST)
X-Precedence: bulk
X-Mailing-List: netdev@vger.kernel.org
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-In-Reply-To: <20261014-dev-mctp-usb-lib-test-v3-0-ee5bc3ea1db1@codeconstruct.com.au>
X-Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, 
 linux-hardening@vger.kernel.org, James Lee <james@codeconstruct.com.au>
X-Mailer: b4 0.14.2