2023-03-29 19:08:31

by Song Liu

[permalink] [raw]
Subject: Re: [0/2] md/raid: Adjustments for two function implementations

On Tue, Mar 28, 2023 at 10:32 PM Markus Elfring <[email protected]> wrote:
>
> >> raid1: Fix exception handling in setup_conf()
> >> raid10: Fix exception handling in setup_conf()
> >
> > The two functions look good to me as-is. I don't think anything is
> > broken except that the code analysis tool complains. I don't think
> > it is necessary to make these changes.
>
> Will development interests ever grow also for advice from another information source?
> https://wiki.sei.cmu.edu/confluence/display/c/MEM12-C.+Consider+using+a+goto+chain+when+leaving+a+function+on+error+when+using+and+releasing+resources#MEM12C.Considerusingagotochainwhenleavingafunctiononerrorwhenusingandreleasingresources-CompliantSolution%28POSIX,GotoChain%29

While I understand "goto chain" is a good pattern for error handling, I am
not convinced it is a better approach here. Specifically, the goto chain is so
long that it is hard to maintain. This also adds overhead for users of
git-blame. Therefore, I would rather keep these two functions as-is.

Thanks,
Song