🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #21111

Re: [PATCH net-next] net: pcs: xpcs-rk: use cleanup.h for platform_device reference

#21111
From: Andrew Lunn
Date: Mon, 23 Nov 2026 15:11
22 lines
9006 bytes
On Mon, Nov 23, 2026 at 08:30:53PM +0800, Coia Prant wrote:
> Use the __free(platform_device_put) cleanup action to manage the
> platform_device reference obtained from of_find_device_by_node().
> 
> This removes the need for explicit put_device() calls on every failure
> path and at the end of the successful path, simplifying the function
> and reducing the chance of reference leaks or double puts.
> 
> Signed-off-by: Coia Prant <coiaprant@gmail.com>

https://www.kernel.org/doc/html/latest/process/maintainer-netdev.html

Low level cleanup constructs (such as __free()) can be used when
building APIs and helpers, especially scoped iterators. However,
direct use of __free() within networking core and drivers is
discouraged.

    Andrew

---
pw-bot: cr
Technical Details
Message-ID: <814be8ca-6fe4-401a-af4e-206f1b67be74@lunn.ch>
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-369520-linux-kernel-netdev=dewy.ru
References: <20261123123052.578956-2-coiaprant@gmail.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-369520-linux-kernel-netdev=dewy.ru
From: andrew@lunn.ch (Andrew Lunn)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net-next] net: pcs: xpcs-rk: use cleanup.h for
 platform_device reference
Date: Mon, 23 Nov 2026 16:11:00 +0100
Organization: Usenet Network
Message-ID: <814be8ca-6fe4-401a-af4e-206f1b67be74@lunn.ch>
References: <20261123123052.578956-2-coiaprant@gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Info: usenet.network;
	logging-data="3910250"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:kSD2QysT8ZkKDM1r4oy52FFlf78= sha256:idRupyAFpNp3zh0H4vadECIQ27bv0jinUbPcvls2JPo=
	sha1:RuV/psdtMTMXjD40KDmzRF8dpXk= sha256:2yIiWcsAiGuRr4fWyL+PtKeTbTLld0WLw/cjabwI+18=
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 010AE125DBC; Mon, 23 Nov 2026 18:11:27 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.051
X-Spam-Status: No, score=-3.051 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] 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 QlHxmy8wjJ3A;
	Mon, 23 Nov 2026 18:11:20 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-369520-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 D01AA125DBA; Mon, 23 Nov 2026 18:11:11 +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 C5FD330B66; Mon, 23 Nov 2026 15:11:03 +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=1795446663;
	b=4qwiJT4JIllm7Tyz/OG9ThEV/cOa6dz4Gq1bnPRcxjgVspLsReJQD1pOdyTGt4sFDows
	 bMJx68W3px5uReuW6G27CNGe0Y2YLC9I2ziGPbEnsu9f4egMcBXuxP2n0+VFdaInKV+0o
	 nBZ6giBRy5dQ2V8yuZ+6DKW0KWjtLDEcl4I8/cdncxCVWZm2bVq6EBRoYruT1ttKsuohC
	 YV1+qVahFjjfVj7yllcLIZXODpQKq/uEPCeCd31bj4XRb2NMHuTue/c8oQ7c3BVFTAZUW
	 QuJjDFjFlzOfosgP3fXqUuOaYVsYH/S3fxeoXdJ1l5KO8KicEKjS6AknCnXK9+VEiiA==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795446663;
	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=4D/pNtTn3K7Pquh1FRZ6xItg3AzYP2AHx7ViO6lbqj4=;
	b=g5vnjr6pl/SjocIkGU2EdCQAegWXD8Hli/lRk5jTWypD3s+8VHwf4cNN31STXDVWeo6T
	 N9DMwth4xrME2ABNpyvtNA9xCv0SyqHg9x7ooiFfsA1hF0j4PD8E925JZMxUHVdUNBlc8
	 ZvTh4OyXabUNE/4eETfekoInYKoLtadJhA/wqmRoVIL/PEbJC1PGFPAe5J8VMX8ZsTxPS
	 5xolSHBJG6sGtv6BwSUweq15j/JDqkGIue3LgTuiNiDgCA4/ESG8fjHTr1RQoMkgjx/gW
	 f4y4Ys0nsAh9s98Usvo7Ck/ZwQau/KUB1fZeYTK0oTo+/CIudaM2VWQAcDbXTmjfBqQ==
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="II0cW/A5";
	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 5B24E606A32D;
	Mon, 23 Nov 2026 15:11:03 +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=II0cW/A5
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=1795446662;
	b=GftfROH2DI6NaSq9a9Xx8W+IvSUqJErntpJVQA8axwYm7vmQq/Hg20EaoS4c+nwiV69H
	 cvEdCkHZFRSp9+pMLGYgfeW4o1iTKe37B9Gqn5bIK800+5ipTeYtHpwAO99QNzO0txoCJ
	 qs++sRuYRKi6a1m/gFPEV/uwfDVfDtv7BbUio9/V0hEg4B1U11uWgTjUQ5TmrO48lQi8C
	 qhalshlH2rnfXgaAc6Q3/URyBHZg7ajZNHPho7aKD8TGfnwS0sBNFGGMo/ZEy/VkaWfLQ
	 ExN1O0AAAOmPHPHrhl34LCiQfjF/boHErPw9liAXaDL6LQRrDu/Ag7WqowWOJE0EFqQ==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795446662;
	h=DMARC-Filter:DKIM-Signature:Received:Date:From:To:Cc:Subject:
	 Message-ID:References:MIME-Version:Content-Type:Content-Disposition:
	 In-Reply-To;
	bh=4D/pNtTn3K7Pquh1FRZ6xItg3AzYP2AHx7ViO6lbqj4=;
	b=SssCO1v6vkyhmBaCQ8Nn1hXRFByc9U6VZOHe2coEiSCPivWmXmWTBpqTz9wwAoXmZiFP
	 AVtigNYEQCN9luZ0NR+q0ckAbPTezQJKffpW0GlRQOIV2Zhs4QotSbMU1deW42owR8bul
	 L6kuYvKF56JxtjSoGIQ9mcR+ooE7XsZpUG09U8yKYLq+xEPZYka6OswYOtq/Trwroem8C
	 DgGcrh+jRV7bX/f75I7gVv7I6CK4yqUrlB/avRR+vOxHv/XwFLB868h0hTqdpz8vaS6s6
	 p7ZfAov8aJPFIHA5u3hT61wPUJnQKVxaSQ3XFefO7Oh7y9rNCjkO3P7FaXe6L4wWSiQ==
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="II0cW/A5";
	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 303C3606A31A
	for <netdev@vger.kernel.org>; Mon, 23 Nov 2026 15:11:02 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 303C3606A31A
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=4D/pNtTn3K7Pquh1FRZ6xItg3AzYP2AHx7ViO6lbqj4=; b=II0cW/A5ihPuXaD7WA7mipn6T/
	xYDcBLLJE+qyZIyyKdzZ10WL6PEM+MlE4xPnVdtqtmRw3ST3tVFi4ZT/2CK6vla5b1eGq+ulqNhai
	4dP7JCI7qmO8nLZv8eC1ZwdG1sKLsxGXn2ftK8CJZOKYafP4nYhlmIlxEYVqp9eUh84w=;
X-Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2)
	(envelope-from <andrew@lunn.ch>)
	id 1xVVh6-000ofw-1z; Mon, 23 Nov 2026 16:11:00 +0100
X-Cc: netdev@vger.kernel.org, "David S . Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@kernel.org>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Heiner Kallweit <hkallweit1@gmail.com>,
	Russell King <linux@armlinux.org.uk>,
	linux-rockchip@lists.infradead.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: <20261123123052.578956-2-coiaprant@gmail.com>