Hi Peter, > -----Original Message----- > From: Peter Maydell [mailto:peter.mayd...@linaro.org] > Sent: Saturday, April 28, 2018 12:15 AM > To: Michael S. Tsirkin <m...@redhat.com> > Cc: QEMU Developers <qemu-devel@nongnu.org>; Gonglei (Arei) > <arei.gong...@huawei.com>; longpeng <longpe...@huawei.com>; Zhoujian (jay) > <jianjay.z...@huawei.com>; Paolo Bonzini <pbonz...@redhat.com> > Subject: Re: [PULL 10/13] cryptodev: add vhost-user as a new cryptodev > backend > > On 1 March 2018 at 16:46, Michael S. Tsirkin <m...@redhat.com> wrote: > > From: Gonglei <arei.gong...@huawei.com> > > > > Usage: > > -chardev socket,id=charcrypto0,path=/path/to/your/socket > > -object cryptodev-vhost-user,id=cryptodev0,chardev=charcrypto0 > > -device virtio-crypto-pci,id=crypto0,cryptodev=cryptodev0 > > > > Signed-off-by: Gonglei <arei.gong...@huawei.com> > > Signed-off-by: Longpeng(Mike) <longpe...@huawei.com> > > Signed-off-by: Jay Zhou <jianjay.z...@huawei.com> > > Reviewed-by: Michael S. Tsirkin <m...@redhat.com> > > Signed-off-by: Michael S. Tsirkin <m...@redhat.com> > > Hi; Coverity (CID 1390600) points out that there's dead code in this function: > > > +static void cryptodev_vhost_user_event(void *opaque, int event) { > > + CryptoDevBackendVhostUser *s = opaque; > > + CryptoDevBackend *b = CRYPTODEV_BACKEND(s); > > + Error *err = NULL; > > We set err to NULL here... > > > + int queues = b->conf.peers.queues; > > + > > + assert(queues < MAX_CRYPTO_QUEUE_NUM); > > + > > + switch (event) { > > + case CHR_EVENT_OPENED: > > + if (cryptodev_vhost_user_start(queues, s) < 0) { > > + exit(1); > > + } > > + b->ready = true; > > + break; > > + case CHR_EVENT_CLOSED: > > + b->ready = false; > > + cryptodev_vhost_user_stop(queues, s); > > + break; > > + } > > ...and nothing here does anything with err... > > > + > > + if (err) { > > + error_report_err(err); > > + } > > ...so this if() is all dead code and we could remove err entirely.
Thanks for reporting this. I'll send a patch to fix it. Regards, Jay