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

Attachment: signature.asc
Description: Digital signature

_______________________________________________
U-Boot mailing list
[email protected]
https://lists.denx.de/listinfo/u-boot

Reply via email to