On Tue, Oct 17, 2023 at 05:51:49PM +0100, Joao Martins wrote: > Perhaps that could be rewritten as e.g. > > ret = -EINVAL; > iopt_for_each_contig_area(&iter, area, iopt, iova, last_iova) { > // do iommu_read_and_clear_dirty(); > } > > // else fail. > > Though OTOH, the places you wrote as to fail are skipped instead. Yeah, if consolidating the areas isn't important (it probably isn't) then this is the better API It does check all the same things: iopt_area_contig_done() will fail Jason