From: "Jan Beulich" Subject: Re: [PATCH v9 08/14] xen/x86: factor out map and unmap from the memory_mapping DOMCTL Date: Thu, 03 Jul 2014 11:43:35 +0100 Message-ID: <53B54FF70200007800020207@mail.emea.novell.com> References: <1404326543-16875-1-git-send-email-avanzini.arianna@gmail.com> <1404326543-16875-9-git-send-email-avanzini.arianna@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1404326543-16875-9-git-send-email-avanzini.arianna@gmail.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: Arianna Avanzini Cc: Ian.Campbell@eu.citrix.com, paolo.valente@unimore.it, keir@xen.org, stefano.stabellini@eu.citrix.com, andrew.cooper3@citrix.com, dario.faggioli@citrix.com, Ian.Jackson@eu.citrix.com, xen-devel@lists.xen.org, julien.grall@citrix.com, etrudeau@broadcom.com, tim@xen.org, viktor.kleinik@globallogic.com List-Id: xen-devel@lists.xenproject.org >>> On 02.07.14 at 20:42, wrote: > +int unmap_mmio_regions(struct domain *d, > + unsigned long start_gfn, > + unsigned long nr, > + unsigned long mfn) > +{ > + int ret = 0, err = 0; > + unsigned long i; > + > + if ( !paging_mode_translate(d) ) > + return 0; > + > + for ( i = 0; i < nr; i++ ) { > + ret = clear_mmio_p2m_entry(d, start_gfn + i, _mfn(mfn + i)); > + if ( ret ) err = ret; > + } There are two coding style problems here ({ on a separate line, and bodies of if()'s belong on separate lines). Additionally the initializer of "ret" is pointless; in fact you could move that variable into the for() scope, with the call to clear_mmio_p2m_entry() being the initializer. Jan