Re: [PATCH v2 1/3] btrfs: remove pointless out label in find_first_block_group

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 27/05/2020 15:07, David Sterba wrote:
> On Wed, May 27, 2020 at 05:12:25PM +0900, Johannes Thumshirn wrote:
>> The 'out' label in find_first_block_group() does not do anything in terms
>> of cleanup.
>>
>> It is better to directly return 'ret' instead of jumping to out to not
>> confuse readers. Additionally there is no need to initialize ret with 0.
> 
> https://www.kernel.org/doc/html/latest/process/coding-style.html#centralized-exiting-of-functions
> 

To cite the Link you posted:

"The goto statement comes in handy when a function exits from multiple 
locations and some common work such as cleanup has to be done. If there 
is no cleanup needed then just return directly."




[Index of Archives]     [Linux Filesystem Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux