[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <65fdd7ae82934_4a98a29429@dwillia2-mobl3.amr.corp.intel.com.notmuch>
Date: Fri, 22 Mar 2024 12:10:38 -0700
From: Dan Williams <dan.j.williams@...el.com>
To: Peter Zijlstra <peterz@...radead.org>, Dan Williams
<dan.j.williams@...el.com>
CC: <torvalds@...ux-foundation.org>, Bjorn Helgaas <bhelgaas@...gle.com>, "Ira
Weiny" <ira.weiny@...el.com>, Jonathan Cameron <jonathan.cameron@...wei.com>,
Jesse Brandeburg <jesse.brandeburg@...el.com>, Ilpo
Järvinen <ilpo.jarvinen@...ux.intel.com>, Lukas Wunner
<lukas.wunner@...el.com>, Jonathan Corbet <corbet@....net>,
<linux-pci@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
<gregkh@...uxfoundation.org>, <linux-doc@...r.kernel.org>
Subject: Re: [PATCH] cleanup: Add usage and style documentation
Peter Zijlstra wrote:
> On Wed, Mar 20, 2024 at 03:04:41PM -0700, Dan Williams wrote:
>
> > diff --git a/include/linux/cleanup.h b/include/linux/cleanup.h
> > index c2d09bc4f976..4620a475faee 100644
> > --- a/include/linux/cleanup.h
> > +++ b/include/linux/cleanup.h
> > @@ -4,6 +4,118 @@
> >
> > #include <linux/compiler.h>
> >
> > +/**
> > + * DOC: scope-based cleanup helpers
> > + *
> > + * The "goto error" pattern is notorious for introducing subtle resource
> > + * leaks. It is tedious and error prone to add new resource acquisition
> > + * constraints into code paths that already have several unwind
> > + * conditions. The "cleanup" helpers enable the compiler to help with
> > + * this tedium and can aid in maintaining FILO (first in last out)
> > + * unwind ordering to avoid unintentional leaks.
> > + *
> > + * As drivers make up the majority of the kernel code base lets describe
> > + * the Theory of Operation, Coding Style implications, and motivation
> > + * for using these helpers through the example of cleaning up PCI
> > + * drivers with DEFINE_FREE() and DEFINE_GUARD(), e.g.:
> > + *
> > + * .. code-block:: c
> > + *
>
> So I despise all that RST stuff. It makes what should be trivially
> readable text into a trainwreck. We're coders, we use text editors to
> read comments.
Ok, I will rip out the RST stuff and just make this a standalone comment.
Powered by blists - more mailing lists