From: George Dunlap <george.dunlap@eu.citrix.com>
To: Ian Campbell <Ian.Campbell@citrix.com>
Cc: "sstanisi@cbnco.com" <sstanisi@cbnco.com>,
"xen-devel@lists.xen.org" <xen-devel@lists.xen.org>,
Ian Jackson <Ian.Jackson@eu.citrix.com>,
Roger Pau Monne <roger.pau@citrix.com>
Subject: Re: [PATCH v4 1/2] libxl: Introduce functions to add and remove USB devices to an HVM guest
Date: Wed, 17 Apr 2013 11:25:55 +0100 [thread overview]
Message-ID: <516E78B3.1080005@eu.citrix.com> (raw)
In-Reply-To: <1366193615.8399.228.camel@zakaz.uk.xensource.com>
On 17/04/13 11:13, Ian Campbell wrote:
> On Wed, 2013-04-17 at 11:02 +0100, George Dunlap wrote:
>> On 17/04/13 10:58, Ian Campbell wrote:
>>> 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 ;-)
>> OK -- well in that block in particular, it's following suit with the
>> rest of the surrounding code which does exactly the same thing.
> That code predates the panic on ENOMEM behaviour.
>
>> As I
>> said in another e-mail to roger about error checking in this function, I
>> think that it's more important for programmers to be able to see this is
>> exactly the same as all the rest. At some point there should probably
>> be a clean-up to remove the check from all of them, but I don't think
>> that's worth the risk at this point in the release cycle.
> Rather than having a massive flag day we are taking the approach of
> fixing code as it is changed and part of that is to not introduce new
> "incorrect" code.
I think that makes sense on a function-by-function, or perhaps
file-by-file basis, but I personally think it's a bad idea to mix
"templates" in one function like that. But if that's the plan, I'll go
with it.
-George
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
prev parent reply other threads:[~2013-04-17 10:25 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-11 18:51 [PATCH v4 1/2] libxl: Introduce functions to add and remove USB devices to an HVM guest George Dunlap
2013-04-11 18:51 ` [PATCH v4 2/2] xl: Add commands for usb hot-plug George Dunlap
2013-04-17 10:02 ` Roger Pau Monné
2013-04-17 10:03 ` George Dunlap
2013-04-17 10:15 ` Ian Campbell
2013-04-17 10:20 ` George Dunlap
2013-04-17 11:48 ` Ian Jackson
2013-04-17 11:44 ` Ian Jackson
2013-04-11 18:55 ` [PATCH v4 1/2] libxl: Introduce functions to add and remove USB devices to an HVM guest George Dunlap
2013-04-16 15:38 ` George Dunlap
2013-04-16 18:00 ` Roger Pau Monné
2013-04-17 9:36 ` George Dunlap
2013-04-17 9:48 ` Roger Pau Monné
2013-04-17 10:05 ` George Dunlap
2013-04-17 11:46 ` Ian Jackson
2013-04-17 9:54 ` Ian Campbell
2013-04-17 9:59 ` George Dunlap
2013-04-17 11:41 ` Ian Jackson
2013-04-17 9:58 ` Ian Campbell
2013-04-17 10:02 ` George Dunlap
2013-04-17 10:13 ` Ian Campbell
2013-04-17 10:25 ` George Dunlap [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=516E78B3.1080005@eu.citrix.com \
--to=george.dunlap@eu.citrix.com \
--cc=Ian.Campbell@citrix.com \
--cc=Ian.Jackson@eu.citrix.com \
--cc=roger.pau@citrix.com \
--cc=sstanisi@cbnco.com \
--cc=xen-devel@lists.xen.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.