On Apr 15 12:52, Philippe Mathieu-Daudé wrote: > On 4/15/20 12:24 PM, Klaus Jensen wrote: > > From: Klaus Jensen <k.jen...@samsung.com> > > > > Signed-off-by: Klaus Jensen <k.jen...@samsung.com> > > --- > > hw/block/nvme.c | 15 ++++++++++++--- > > 1 file changed, 12 insertions(+), 3 deletions(-) > > > > diff --git a/hw/block/nvme.c b/hw/block/nvme.c > > index e67f578fbf79..f0989cbb4335 100644 > > --- a/hw/block/nvme.c > > +++ b/hw/block/nvme.c > > @@ -1348,6 +1348,17 @@ static void nvme_init_state(NvmeCtrl *n) > > n->cq = g_new0(NvmeCQueue *, n->params.max_ioqpairs + 1); > > } > > +static int nvme_init_blk(NvmeCtrl *n, Error **errp) > > +{ > > + blkconf_blocksizes(&n->conf); > > + if (!blkconf_apply_backend_options(&n->conf, > > blk_is_read_only(n->conf.blk), > > + false, errp)) { > > + return -1; > > + } > > + > > + return 0; > > I'm not sure this is a correct usage of the 'propagating errors' API (see > CODING_STYLE.rst and include/qapi/error.h), I'd expect this function to > return void, and use a local_error & error_propagate() in nvme_realize(). > > However this works, so: > Reviewed-by: Philippe Mathieu-Daudé <phi...@redhat.com> >
So, I get that and did use the propagate functionality earlier. But I still used the int return. I'm not sure about the style if returning void - should I check if errp is now non-NULL? Point is that I need to return early since the later calls could fail if previous calls did not complete successfully.