From: "Jan Beulich" Subject: Re: [PATCH v4 8/8] ioreq-server: bring the PCI hotplug controller implementation into Xen Date: Wed, 09 Apr 2014 14:34:07 +0100 Message-ID: <5345686F0200007800007313@nat28.tlf.novell.com> References: <1396451496-5716-1-git-send-email-paul.durrant@citrix.com> <1396451496-5716-9-git-send-email-paul.durrant@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1396451496-5716-9-git-send-email-paul.durrant@citrix.com> Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Paul Durrant Cc: xen-devel@lists.xen.org, Ian Jackson , Ian Campbell , Stefano Stabellini List-Id: xen-devel@lists.xenproject.org >>> On 02.04.14 at 17:11, wrote: > +static int handle_gpe_io( > + int dir, uint32_t port, uint32_t bytes, uint32_t *val) > +{ > + struct vcpu *v = current; > + struct domain *d = v->domain; > + struct hvm_hotplug *hp = &d->arch.hvm_domain.hotplug; > + > + if ( bytes != 1 ) Is this really a valid restriction? > +int gpe_init(struct domain *d) > +{ > + struct hvm_hotplug *hp = &d->arch.hvm_domain.hotplug; > + > + hp->gpe_sts = xzalloc_array(uint8_t, ACPI_GPE0_BLK_LEN_V1 / 2); > + if ( hp->gpe_sts == NULL ) > + goto fail1; > + > + hp->gpe_en = xzalloc_array(uint8_t, ACPI_GPE0_BLK_LEN_V1 / 2); > + if ( hp->gpe_en == NULL ) > + goto fail2; I'd like to ask (also elsewhere in this series) to try to limit the number of "goto"s to the absolute minimum required to help code readability. There's no need for them here: Allocate both blocks, then check both pointers, and if either is NULL free them both in a single error path. Jan