qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 30/31] blockdev: Convert drive_new() to Error


From: Kevin Wolf
Subject: Re: [Qemu-devel] [PATCH 30/31] blockdev: Convert drive_new() to Error
Date: Fri, 12 Oct 2018 16:50:44 +0200
User-agent: Mutt/1.10.1 (2018-07-13)

Am 12.10.2018 um 14:28 hat Max Reitz geschrieben:
> >>> @@ -1155,8 +1155,7 @@ static void default_drive(int enable, int snapshot, 
> >>> BlockInterfaceType type,
> >>>          drive_enable_snapshot(NULL, opts, NULL);
> >>>      }
> >>>  
> >>> -    dinfo = drive_new(opts, type);
> >>> -    assert(dinfo);
> >>> +    dinfo = drive_new(opts, type, &error_abort);
> >>
> >> Which means the assertion is still necessary here.
> > 
> > I see very little value in assert(p) right before *p.  Matter of taste,
> > I guess.  Do you want me to keep it?
> 
> True.  "An assertion looks better to the user" isn't an argument,
> considering the user shouldn't ever see assertions either.

The point that could be made is that it documents that we're aware that
drive_new() can return NULL generally, but we've made sure that with the
specific options passed it doesn't happen here, so not having any error
handling is not a bug, but intended.

> So feel free to drop it indeed.

I don't mind either way.

Kevin

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]