> +static int vp_channel_send_all(VPDriver *drv, uint8_t *buf, int count)
> +{
> +    int ret;
> +    CharDriverState *chr = drv->chr;
> +
> +    if (drv->chr != NULL) {
> +        /* send data to guest via channel device's read handler */
> +        vp_chr_read(chr, buf, count);
> +        /* TODO: we assume here the full buffer was written to device
> +         * due to the dev write handler being a void function.
> +         * can we confirm? Do we need to?
> +         */
> +        ret = count;
> +    } else if (drv->channel_fd != -1) {
> +        /* send data to host via channel fd */
> +        ret = vp_send_all(drv->channel_fd, buf, count);
> +        if (ret == -1) {
> +            LOG("error sending data");
> +            goto out_bad;
> +        }
> +    } else {
> +        LOG("driver in unknown state");
> +        goto out_bad;
> +    }
> +
> +    return ret;
> +out_bad:
> +    LOG("unable to send to channel");
> +    return -1;
> +}
> +

Propagate the error return value?  Currently this function discards
the specific error and also doesn't LOG() its value.

Stefan

Reply via email to