--- a/lib/logic_pio.c
> +++ b/lib/logic_pio.c
> @@ -56,7 +56,7 @@ int logic_pio_register_range(struct logic_pio_hwaddr *new_range)
> /* for MMIO ranges we need to check for overlap */
> if (start >= range->hw_start + range->size ||
> end < range->hw_start) {
> - mmio_sz += range->size;
> + mmio_sz = range->io_start + range->size;
Should this be renamed to something like "mmio_end"? Computing a
"size" as "start + size" looks wrong at first glance. The code overall
probably makes sense, but maybe breaking this out as a separate "avoid
overlaps" patch that renames "mmio_sz" might make it clearer.
> } else {
> ret = -EFAULT;
> goto end_register;