From: Jonathan Cameron <jic23@kernel.org>
To: Markus Elfring <Markus.Elfring@web.de>
Cc: Tobias Jordan <kernel@cdqe.de>,
linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org,
kernel-janitors@vger.kernel.org,
Lars-Peter Clausen <lars@metafoo.de>,
Nuno Sa <nuno.sa@analog.com>,
Peter Meerwald-Stadler <pmeerw@pmeerw.net>
Subject: Re: [PATCH] iio: temperature: ltc2983: fix leak of device node iterator
Date: Sat, 26 Sep 2020 15:55:21 +0100 [thread overview]
Message-ID: <20200926155521.3b75342f@archlinux> (raw)
In-Reply-To: <b5eca237-b7ea-e4ca-3936-8c32892e49b5@web.de>
On Sat, 26 Sep 2020 16:45:56 +0200
Markus Elfring <Markus.Elfring@web.de> wrote:
> > Thought about adding an "goto err_of_node_put" instead, but as the error
> > paths are quite divergent, I'm not sure if that wouldn't complicate
> > things.
>
> Please add jump targets like “e_inval” and “put_node” so that a bit of
> common exception handling code can be better reused for this function implementation.
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/coding-style.rst?id=7c7ec3226f5f33f9c050d85ec20f18419c622ad6#n475
On this one I think readability would perhaps be hurt a little by
doing so, particular as we need to do the of_put_node in some but
not all non error paths.
It is a close run thing between the two options however.
I considered another option of suggesting factoring out this whole
per node block, but to do that we would have to do something a bit
odd with the return value as we have 3 options.
* error
* do not parse any more children.
* continue to parse children.
So I think in this case Tobias' solution is the best one available.
Thanks,
Jonathan
>
> Regards,
> Markus
next parent reply other threads:[~2020-09-26 14:55 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <b5eca237-b7ea-e4ca-3936-8c32892e49b5@web.de>
2020-09-26 14:55 ` Jonathan Cameron [this message]
2020-09-26 10:45 [PATCH] iio: temperature: ltc2983: fix leak of device node iterator Tobias Jordan
2020-09-26 14:44 ` Jonathan Cameron
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=20200926155521.3b75342f@archlinux \
--to=jic23@kernel.org \
--cc=Markus.Elfring@web.de \
--cc=kernel-janitors@vger.kernel.org \
--cc=kernel@cdqe.de \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nuno.sa@analog.com \
--cc=pmeerw@pmeerw.net \
/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;
as well as URLs for NNTP newsgroup(s).