From: Dan Williams <dan.j.williams@intel.com>
To: Pranav Tyagi <pranav.tyagi03@gmail.com>, <dave@stgolabs.net>,
<jonathan.cameron@huawei.com>, <dave.jiang@intel.com>,
<alison.schofield@intel.com>, <vishal.l.verma@intel.com>,
<ira.weiny@intel.com>, <dan.j.williams@intel.com>
Cc: <ming.li@zohomail.com>, <rrichter@amd.com>,
<jeff.johnson@oss.qualcomm.com>, <peterz@infradead.org>,
<linux-cxl@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
<skhan@linuxfoundation.org>,
<linux-kernel-mentees@lists.linux.dev>,
"Pranav Tyagi" <pranav.tyagi03@gmail.com>
Subject: Re: [PATCH] cxl/port: automate cleanup with __free()
Date: Tue, 24 Jun 2025 10:11:41 -0700 [thread overview]
Message-ID: <685adc4d1487b_1608bd1009b@dwillia2-xfh.jf.intel.com.notmuch> (raw)
In-Reply-To: <20250623091929.366357-1-pranav.tyagi03@gmail.com>
Pranav Tyagi wrote:
> Use the scope based resource management (defined in linux/cleanup.h) to
> automate the lifetime control of struct cxl_endpoint_decoder. This
> eliminates the explicit kfree() call and makes the code more robust and
> maintainable in presence of early returns.
I do not want to review small standalone conversions of individual
functions for no other reason than vague claims of improvement. The
reasons to convert an existing function to cleanup.h helpers are:
1/ to fix an actual bug
2/ in the course of refactoring the code for other reasons
3/ to eliminate goto trickiness and bulk
This patch does not make the code "more robust and maintainable", it is
just churn given how easy it is to verify that the kfree() is correctly
paired.
One quick way to identify code churn is when the diffstat does not
result in a net reduction in code lines:
This patch is "3 insertions(+), 3 deletions(-)" == "churn".
next prev parent reply other threads:[~2025-06-24 17:12 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-23 9:19 [PATCH] cxl/port: automate cleanup with __free() Pranav Tyagi
2025-06-23 9:27 ` Greg KH
2025-06-24 13:56 ` Pranav Tyagi
2025-06-24 17:11 ` Dan Williams [this message]
2025-06-26 14:28 ` Pranav Tyagi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=685adc4d1487b_1608bd1009b@dwillia2-xfh.jf.intel.com.notmuch \
--to=dan.j.williams@intel.com \
--cc=alison.schofield@intel.com \
--cc=dave.jiang@intel.com \
--cc=dave@stgolabs.net \
--cc=ira.weiny@intel.com \
--cc=jeff.johnson@oss.qualcomm.com \
--cc=jonathan.cameron@huawei.com \
--cc=linux-cxl@vger.kernel.org \
--cc=linux-kernel-mentees@lists.linux.dev \
--cc=linux-kernel@vger.kernel.org \
--cc=ming.li@zohomail.com \
--cc=peterz@infradead.org \
--cc=pranav.tyagi03@gmail.com \
--cc=rrichter@amd.com \
--cc=skhan@linuxfoundation.org \
--cc=vishal.l.verma@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox