From: Ian Jackson Subject: Re: [PATCH v9 06/17] libxl: convert libxl__device_disk_local_attach to an async op Date: Fri, 20 Jul 2012 18:45:04 +0100 Message-ID: <20489.39200.235017.295823@mariner.uk.xensource.com> References: <1342172696-88347-1-git-send-email-roger.pau@citrix.com> <1342172696-88347-7-git-send-email-roger.pau@citrix.com> <20488.13049.768622.309067@mariner.uk.xensource.com> <50092975.9060001@citrix.com> <20489.16555.897359.556419@mariner.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20489.16555.897359.556419@mariner.uk.xensource.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Roger Pau Monne , "xen-devel@lists.xen.org" , Stefano Stabellini List-Id: xen-devel@lists.xenproject.org Ian Jackson writes ("Re: [PATCH v9 06/17] libxl: convert libxl__device_disk_local_attach to an async op"): > Roger Pau Monne writes ("Re: [PATCH v9 06/17] libxl: convert libxl__device_disk_local_attach to an async op"): > > [stuff] > > Thanks. > > > Ian Jackson wrote: > > >> diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c > > > ... > > >> @@ -2191,6 +2202,7 @@ char * libxl__device_disk_local_attach(libxl__gc *gc, > > >> default: > > >> LIBXL__LOG(ctx, LIBXL__LOG_ERROR, > > >> "unrecognized disk format: %d", disk->format); > > >> + rc = ERROR_FAIL; > > >> break; > > > > > > Why `break' and not `goto out' ? (Here and later.) > > > > > > Perhaps this would be clear from context. > > > > This is part of the original code, and I don't think it's a good idea to > > add more patches to my series, if we want to get them in for 4.2. > > Perhaps this would have been clearer in context. Can I have a git > branch to look at next time pretty please ? :-) (I see you're working > on that, great, thanks.) I have looked at this in context and it doesn't seem right to me. Or at least not clearly right. `break' here ends up falling out of the switch and executes this: if (disk->vdev != NULL) { rc = libxl__device_from_disk(gc, LIBXL_TOOLSTACK_DOMID, disk, &device); if (rc < 0) goto out; In the general case vdev will be non-0, so the rc = ERROR_FAIL is lost. I think you can fix thi sin the same patch as you add the assignments to rc, changing the error breaks to `goto out'. Would that make the code right in your opinion ? Ian.