🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #12803

Re: [PATCH net-next] net: dsa: motorcomm: Free the MIB block on port teardown

#12803
From: Andrew Lunn
Date: Sun, 08 Nov 2026 16:50
16 lines
8706 bytes
> @@ -2006,12 +2006,11 @@ static int yt921x_dsa_port_setup(struct dsa_switch *ds, int port)
>  	struct yt921x_priv *priv = dsa_to_yt921x_priv(ds);
>  	struct yt921x_port *pp = &priv->ports[port];
>  	const struct yt921x_info *info = priv->info;
> -	struct device *dev = yt921x_priv_to_device(priv);
>  	struct yt921x_mib *pm = pp->mib;
>  	int res;
>  
>  	if (!pm && (BIT(port) & yt921x_info_ports_mask(info))) {
> -		pm = devm_kzalloc(dev, sizeof(*pm), GFP_KERNEL);
> +		pm = kvzalloc_obj(*pm);

Is the if (!pm still needed?

   Andrew
Technical Details
Message-ID: <aaed4927-d124-438a-8526-2b8f51ca3732@lunn.ch>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-358807-linux-kernel-netdev=dewy.ru
References: <20261108101648.1308271-1-mmyangfl@gmail.com>

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-358807-linux-kernel-netdev=dewy.ru
From: andrew@lunn.ch (Andrew Lunn)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net-next] net: dsa: motorcomm: Free the MIB block on port
 teardown
Date: Sun, 8 Nov 2026 17:50:29 +0100
Organization: Usenet Network
Message-ID: <aaed4927-d124-438a-8526-2b8f51ca3732@lunn.ch>
References: <20261108101648.1308271-1-mmyangfl@gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Info: usenet.network;
	logging-data="161818"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:SuSeKmnrjgfoBbXgFO9rG8FWkCk= sha256:6VdpW0BOO6nJwfsMZ+ZyrX17uWuDSp5UrUgari4IrsM=
	sha1:wZOvzzPU2Y7QvWyFVLHRr3jxRhU= sha256:S+GF3FjolcLlqqfqXidU2RBPUQVlp3CJ7p6eN+x9vec=
Content-Disposition: inline
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 245501135C8; Sun,  8 Nov 2026 19:51:19 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.05
X-Spam-Status: No, score=-3.05 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
	DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.249,
	MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
	SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (1024-bit key)
	header.d=lunn.ch
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 aFfPLvMBmQs4;
	Sun,  8 Nov 2026 19:51:11 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-358807-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=lunn.ch
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
	by mail.dewy.ru (Postfix) with ESMTPS id 2BC6611356D; Sun,  8 Nov 2026 19:51:03 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sea.lore.kernel.org (Postfix) with ESMTP id EC6E3474DF; Sun,  8 Nov 2026 16:50:52 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1794156652;
	b=HYPkGYCouO8KbiwS3+HQkW2SB+CUbhNJJL7ZfPfgV9iBbCqaEcoUEWDuQwS2L67V5uaG
	 eSLzbkmSjsd0yF0w0NREg2uClNKdF2NKTH+NArhcmw9BKa5xRi9qzhTqd/7cqdvclPwah
	 kcz1F5oCstPg7YemBjTlobDpFn0Kjc/nn+3JwvTZOWzh2jXZSzs3ukeyfKHFE2KWNyy/W
	 zsKaBTAqzwvqYpQj5BE64mdDZ+w5bQsxsVPE5qCtJPfQR7bNyoCCYniUQnf3e0uMqDwd6
	 LWx40F5SgPbZBSWWv9D1m4q36uToXNKxyHlS7Tg+n4C/VJVbbtaO6wfHbMOwSIYFNVQ==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794156652;
	h=X-Original-To:Received:DMARC-Filter:DKIM-Signature:Received:Date:
	 From:To:Cc:Subject:Message-ID:References:X-Mailing-List:List-Id:
	 List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner:
	 Precedence:MIME-Version:Content-Type:Content-Disposition:In-Reply-To;
	bh=UhVknWdLWOdCnQJdj2Amn0VVAYXtsLA3g8RN/p2HGvI=;
	b=LhnW7QyvnAOrQtrNULXLhYr5vLw6AbdlW+QTTZqmhTqwK1Pjq1OygQYCe9jG9uDndFIJ
	 EdNq1DPtLkh/1rBLQyfAaIX39xudXcL2hwGP14KBFoxdSyu8BxCSk/6BCotBEWTq5ld6a
	 YE6CxyWYiIrGjsPS0mp2g0D2JB6RQUhKL9l7x8RtubkeA+k6jntpWwxc0T73c3azvsK82
	 nO04FsGZQBuSFC42LxIA1uFdMNnvGIC2aCTc/6L6wNPDdcer+dpo3GBt0ZAd3ruPx8gLb
	 IBmOwL1OlmOOk+J9fvPyVBQcKpSeVCSY2EEwgb3Fw1dZSUQ0Hs/v+eYzwvD2GQNb2vQ==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=lunn.ch header.i=@lunn.ch header.a=rsa-sha256 header.s=20171124 header.b=T9IH8X6B;
	dmarc=pass header.from=lunn.ch;
	spf=pass smtp.mailfrom=lunn.ch;
	arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id B3B46606A32A;
	Sun,  8 Nov 2026 16:50:52 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (1024-bit key) header.d=lunn.ch header.i=@lunn.ch header.a=rsa-sha256 header.s=20171124 header.b=T9IH8X6B
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=156.67.10.101
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1794156636;
	b=IGNNzME7JINnt8sz1Fu/q2EOLm5MOciL+PklUQWwAbOzUDcmZ8YmRBjTc2p71f8zdE5D
	 uWS05wNE6DxiifO8nwXc06rndR7539cpQV9ptBJz0s0OXiTO4ZVWhep5r4l5WTH2qdxbI
	 8baU9oL5tiIofvsg0yd1KKCpDDoZEsRwYs6UFSxzGy0YiwX7UV1b+OJc93Wyb6x5gYN0F
	 MdBD0qG1nPIMs1e4BXqAoym+DTjKJpTXcJ+4Tkuk84ApD54QsnPOpW2P8y+ZisLL44JtP
	 EqfPAu+Vk0KVC0zxt11r80ArklxEzWtnG3DLsmbMz1UQfWEEX/JuX18zQ5NTp1+EW/w==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794156636;
	h=DMARC-Filter:DKIM-Signature:Received:Date:From:To:Cc:Subject:
	 Message-ID:References:MIME-Version:Content-Type:Content-Disposition:
	 In-Reply-To;
	bh=UhVknWdLWOdCnQJdj2Amn0VVAYXtsLA3g8RN/p2HGvI=;
	b=CCCqbATYBgVEzEl9tGk2pc5I1BT3qo3iKqMoCzma16YeqzfbUtPG4Djhf77RpFXYpFD6
	 WmDovYyzSLaHVDrs31KP5FBzjfAr0SrIxJZhADTyQEFLQCMH2VAqqSyx68fFS0zD1E3X9
	 Etr5IhJ9fMct/261zsUKyVmI5xIbxslBWzhsNKnDTEVda26ev70Jvu1MOnUv2cvZZOICG
	 iN8KqbBgxzKZLH+TMFBMrItAnLLzrEQ7ddv6g8mq8T1Hm0D33NyCvOkaOJ2hj2D+LqGWN
	 mpZQB2a1epC+eT7hgoNwK3gvxe1AP3YoRAIQ0By7205h5UKgj17HlKIJD9G8KBCzt7w==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dmarc=pass header.from=lunn.ch;
	spf=pass smtp.mailfrom=lunn.ch;
	dkim=pass header.d=lunn.ch header.i=@lunn.ch header.a=rsa-sha256 header.s=20171124 header.b=T9IH8X6B;
	arc=none smtp.remote-ip=156.67.10.101
X-Received: from vps0.lunn.ch (vps0.lunn.ch [156.67.10.101])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange ECDHE (prime256v1) server-signature ECDSA (prime256v1) server-digest SHA256)
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3C209606A31C;
	Sun,  8 Nov 2026 16:50:35 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 3C209606A31C
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=lunn.ch
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=lunn.ch
X-DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch;
	s=20171124; h=In-Reply-To:Content-Disposition:Content-Type:MIME-Version:
	References:Message-ID:Subject:Cc:To:From:Date:From:Sender:Reply-To:Subject:
	Date:Message-ID:To:Cc:MIME-Version:Content-Type:Content-Transfer-Encoding:
	Content-ID:Content-Description:Content-Disposition:In-Reply-To:References;
	bh=UhVknWdLWOdCnQJdj2Amn0VVAYXtsLA3g8RN/p2HGvI=; b=T9IH8X6BhM75RmPIk6CAOF0R7w
	PA3Ezh345CTz9zRiWzqWsdcRsviaLQcsbsUR0DveqVcrNNIMCq7xNdvm7nW2cCjJlUa/ZgW2Sxz+y
	woHfhtA/0vMhVDuHK3QI4y2YIGe0bd/9dHNdpJ6c9vgtNdzO5WcMxqzENs8plCtaISCg=;
X-Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2)
	(envelope-from <andrew@lunn.ch>)
	id 1xQ669-00F70k-0j; Sun, 08 Nov 2026 17:50:29 +0100
X-Cc: netdev@vger.kernel.org, Vladimir Oltean <olteanv@gmail.com>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@kernel.org>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	linux-kernel@vger.kernel.org
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list
X-In-Reply-To: <20261108101648.1308271-1-mmyangfl@gmail.com>