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

Re: [Xen-devel] [PATCH v4 1/2] libxl: Introduce functions to add and remove USB devices to an HVM guest



On Tue, 2013-04-16 at 19:00 +0100, Roger Pau Monnà wrote:

> > +    libxl_usb_path = libxl__sprintf(gc, "%s/usb", libxl_path);
> 
> I would recommend to use GCSPRINTF instead, it already checks for errors

GCSPRINTF and libxl__sprintf have the same amount of error checking.

The more important point is that the libxl memory allocation
functions/macros all panic on ENOMEM so there is no need for code in
general to check for allocation errors.

i.e. This block...
> > +    if (!libxl_usb_path) {
> > +        LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "cannot allocate create paths");
> > +        rc = ERROR_FAIL;
> > +        goto out;
> > +    }

...is unneeded. I didn't check the rest of the patch but I imagine you
are in the habits of checking errors and can now remove a bunch of
code ;-)

Ian.


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.