[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20171019143949.2c87ea66@kitsune.suse.cz>
Date: Thu, 19 Oct 2017 14:39:49 +0200
From: Michal Suchánek <msuchanek@...e.de>
To: SF Markus Elfring <elfring@...rs.sourceforge.net>
Cc: linuxppc-dev@...ts.ozlabs.org, Rob Herring <robh@...nel.org>,
Sahil Mehta <sahilmehta17@...il.com>,
Alexey Kardashevskiy <aik@...abs.ru>,
Tyrel Datwyler <tyreld@...ux.vnet.ibm.com>,
kernel-janitors@...r.kernel.org,
Doug Ledford <dledford@...hat.com>,
Johan Hovold <johan@...nel.org>,
Masahiro Yamada <yamada.masahiro@...ionext.com>,
Alex Williamson <alex.williamson@...hat.com>,
Paul Mackerras <paulus@...ba.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Bart Van Assche <bart.vanassche@...disk.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Nathan Fontenot <nfont@...ux.vnet.ibm.com>,
LKML <linux-kernel@...r.kernel.org>,
David Gibson <david@...son.dropbear.id.au>
Subject: Re: [PATCH 4/5] powerpc-pseries: Return directly after a failed
kzalloc_node() in iommu_pseries_alloc_group()
On Thu, 19 Oct 2017 14:04:43 +0200
SF Markus Elfring <elfring@...rs.sourceforge.net> wrote:
> >> @@ -61,7 +61,7 @@ static struct iommu_table_group
> >> *iommu_pseries_alloc_group(int node) table_group =
> >> kzalloc_node(sizeof(*table_group), GFP_KERNEL, node); if
> >> (!table_group)
> >> - goto fail_exit;
> >> + return NULL;
> >>
> >> tbl = kzalloc_node(sizeof(*tbl), GFP_KERNEL, node);
> >> if (!tbl)
> >
> > I have seen quite a few fixes that do inverse of this patch after a
> > piece of code allocating some extra piece of memory was added before
> > code that just returns on fail because it is the first allocation in
> > the function.
> >
> > This is not useful.
>
> How do you think about an information from the section “7)
> Centralized exiting of functions” in the document “coding-style.rst”
> then?
>
> “…
> If there is no cleanup needed then just return directly.
> …”
There is also stated benefit
"
- errors by not updating individual exit points when making
modifications are prevented
"
which is furthered by using the common cleanup even in case no cleanup
is required but running the cleanup does not cause any harm.
Thanks
Michal
Powered by blists - more mailing lists