From: Tom Rini <trini@konsulko.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] test/overlay: Fix various malloc/free leaks
Date: Tue, 26 Sep 2017 15:13:55 -0400 [thread overview]
Message-ID: <20170926191355.GN3112@bill-the-cat> (raw)
In-Reply-To: <0DAF21CFE1B20740AE23D6AF6E54843F1EA7EB5D@IRSMSX101.ger.corp.intel.com>
On Tue, Sep 26, 2017 at 06:28:40PM +0000, Langer, Thomas wrote:
> Hello Tom,
>
> I just read some days ago about the kernel Coding-Style:
>
> <quote>
> Choose label names which say what the goto does or why the goto exists. An
> example of a good name could be ``out_free_buffer:`` if the goto frees ``buffer``.
> Avoid using GW-BASIC names like ``err1:`` and ``err2:``, as you would have to
> renumber them if you ever add or remove exit paths, and they make correctness
> difficult to verify anyway.
> </quote>
>
> Does is make sense to follow this for U-Boot also and fix the names of the labels below?
>
> >
> > free(fdt_overlay_stacked_copy);
> > +err3:
> > free(fdt_overlay_copy);
> > +err2:
> > free(fdt_base_copy);
> > +err1:
> > free(uts);
> >
We have in U-Boot a number of cases of both, and the majority (from a
quick read on 'git grep goto' is of the less descriptive case. I can
certainly see how descriptive goto labels make more sense in the case of
large functions and especially complicated short-cuts. Do you think
'malloc_base_copy_failed', 'malloc_overlay_copy_failed' and
'malloc_stacked_copy_failed' make the code more readable?
--
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170926/552688eb/attachment.sig>
next prev parent reply other threads:[~2017-09-26 19:13 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-26 16:43 [U-Boot] [PATCH] test/overlay: Fix various malloc/free leaks Tom Rini
2017-09-26 18:28 ` Langer, Thomas
2017-09-26 19:13 ` Tom Rini [this message]
2017-10-07 13:09 ` [U-Boot] " Tom Rini
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=20170926191355.GN3112@bill-the-cat \
--to=trini@konsulko.com \
--cc=u-boot@lists.denx.de \
/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