/* Returns: return value of flic_get_all_irqs Note: Retry and increase buffer size until flic_get_all_irqs either returns a value >= 0 or a negative error code. -ENOMEM is an exception, which means the buffer is too small and we should try again. Other negative error codes can be -EFAULT and -EINVAL which we ignore at this point  */
static int __get_all_irqs(KVMS390FLICState *flic, void **buf, int len)
/* Returns: return value of flic_get_all_irqs Note: Retry and increase buffer size until flic_get_all_irqs either returns a value >= 0 or a negative error code. -ENOMEM is an exception, which means the buffer is too small and we should try again. Other negative error codes can be -EFAULT and -EINVAL which we ignore at this point  */
static int __get_all_irqs(KVMS390FLICState *flic, void **buf, int len)
{
    int r;
    do {
        r = flic_get_all_irqs(flic, *buf, len);
        if (r >= 0) {
            break;
        }
        len *= 2;
        *buf = g_try_realloc(*buf, len);
        if (!buf) {
            return -ENOMEM;
        }
    } while (r == -ENOMEM && len <= KVM_S390_FLIC_MAX_BUFFER);
    return r;
}