Re: dm: Use common error handling code in three functions

Markus Elfring <[email protected]>
Newsgroups dev.linux.lists.dm-devel,org.kernel.vger.kernel-janitors,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
>> Use additional labels so that a bit of exception handling can be better
>> reused at the end of three if branches.
>>
>> This issue was detected by using the Coccinelle software.
> 
> Hi
> 
> I think that jumping into a nested block isn't good practice and it makes 
> the code harder to read and maintain. I would redo the patches so that 
> they jump to the end of the topmost function block, for example:
Thanks for your constructive feedback.

Can any further adjustments become feasible for the design goal “Centralized exiting of functions”?
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/coding-style.rst?h=v7.1-rc7#n526

Would you find goto chains applicable for another while?
https://cmu-sei.github.io/secure-coding-standards/sei-cert-c-coding-standard/recommendations/memory-management-mem/mem12-c/

How do you think about to increase the application of scope-based resource management?
https://elixir.bootlin.com/linux/v7.1-rc7/source/include/linux/cleanup.h

Regards,
Markus
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.