Thread (3 messages) 3 messages, 3 authors, 2021-09-29

Re: [PATCH] btrfs: turn btrfs_destroy_all_ordered_extents() into void functions

From: David Sterba <hidden>
Date: 2021-03-02 12:54:32
Also in: lkml

On Tue, Mar 02, 2021 at 04:57:56PM +0800, Yang Li wrote:
These functions always return '0' and no callers use the return
value. So make it a void function.
The reasoning needs to go the other way around: you can make a function
return void iff all callees also return void and don't do BUG_ON instead
of proper error handling.

Which in this case does not hold, because the function itself still does
BUG_ON.
It fixes the following warning detected by coccinelle:
./fs/btrfs/disk-io.c:4522:5-8: Unneeded variable: "ret". Return "0" on
line 4530
Yeah tools can identify the simple cases but fixing that properly needs
to extend to the whole callgraph and understand all the contexts where
local data are undone and errors propagated up the callchanin.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help