On Thu, 2015-07-23 at 10:22 +0100, Ian Campbell wrote: > On Thu, 2015-07-23 at 08:59 +0100, Wei Liu wrote: > > There is change of behaviour. Previously if memory allocation fails > > the > > said function returns NULL. Now memory allocation failure is fatal. > > This > > is in line with how we deal with memory allocation failure in other > > places in libxl though. > > I think this function would benefit from making the out: label be the > error path and the success case just a return ptr (just before the > label). > > Then your error handling for cpupool_info would become > libxl_cpupoolinfo_dispose(&info); > if (errno != ENOENT) goto out; > break; > > and the "if (failed)" block would be at the out label (without the > iff). > I was about to give my Reviewed-by, but yes, I like Ian's suggestion too. In any case, apart from how error handling is done, I think this patch is fine, as far as dealing with cpupools goes. Dario -- <> (Raistlin Majere) ----------------------------------------------------------------- Dario Faggioli, Ph.D, http://about.me/dario.faggioli Senior Software Engineer, Citrix Systems R&D Ltd., Cambridge (UK)