[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250926134520.502f0009@kernel.org>
Date: Fri, 26 Sep 2025 13:45:20 -0700
From: Jakub Kicinski <kuba@...nel.org>
To: Daniel Jurgens <danielj@...dia.com>
Cc: <netdev@...r.kernel.org>, <mst@...hat.com>, <jasowang@...hat.com>,
<alex.williamson@...hat.com>, <pabeni@...hat.com>,
<virtualization@...ts.linux.dev>, <parav@...dia.com>,
<shshitrit@...dia.com>, <yohadt@...dia.com>, <xuanzhuo@...ux.alibaba.com>,
<eperezma@...hat.com>, <shameerali.kolothum.thodi@...wei.com>,
<jgg@...pe.ca>, <kevin.tian@...el.com>, <andrew+netdev@...n.ch>,
<edumazet@...gle.com>
Subject: Re: [PATCH net-next v3 04/11] virtio_net: Query and set flow filter
caps
On Tue, 23 Sep 2025 09:19:13 -0500 Daniel Jurgens wrote:
> + struct virtio_admin_cmd_query_cap_id_result *cap_id_list __free(kfree) = NULL;
Please don't use the __free(), you already have an error path in this
function, what is the point. Plus
Quoting documentation:
Using device-managed and cleanup.h constructs
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Netdev remains skeptical about promises of all "auto-cleanup" APIs,
including even ``devm_`` helpers, historically. They are not the preferred
style of implementation, merely an acceptable one.
Use of ``guard()`` is discouraged within any function longer than 20 lines,
``scoped_guard()`` is considered more readable. Using normal lock/unlock is
still (weakly) preferred.
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.
Similar guidance applies to declaring variables mid-function.
See: https://www.kernel.org/doc/html/next/process/maintainer-netdev.html#using-device-managed-and-cleanup-h-constructs
Powered by blists - more mailing lists