The idr_for_each_entry() macro uses an if statement to update _entry and _in in the loop body. This can lead to dangling else issues, or at least a compiler warning of the potential thereof.
We build with -Werror=dangling-else in CI and that is triggered very easily by this construct. Move the loop body into an else to avoid this issue. Reviewed-by: Ahmad Fatoum <[email protected]> Signed-off-by: Jonas Rebmann <[email protected]> --- include/linux/idr.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/idr.h b/include/linux/idr.h index e726d17b59..206c006c62 100644 --- a/include/linux/idr.h +++ b/include/linux/idr.h @@ -41,7 +41,7 @@ struct idr { *tmp = iter ? list_next_entry(iter, list) : NULL; \ (iter && iter != (_idr)) || (_entry = NULL); \ iter = tmp, tmp = tmp ? list_next_entry(tmp, list) : NULL)\ - if ((_entry = iter->ptr, _id = iter->id, true)) + if ((_entry = iter->ptr, _id = iter->id, false)) {} else struct idr *__idr_find(struct idr *head, int lookup_id); -- 2.51.2.535.g419c72cb8a
