From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35916) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WDmXY-0001bK-NK for qemu-devel@nongnu.org; Wed, 12 Feb 2014 22:00:49 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WDmXO-0002pf-JG for qemu-devel@nongnu.org; Wed, 12 Feb 2014 22:00:40 -0500 Received: from e28smtp08.in.ibm.com ([122.248.162.8]:38111) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WDmXN-0002oO-Nq for qemu-devel@nongnu.org; Wed, 12 Feb 2014 22:00:30 -0500 Received: from /spool/local by e28smtp08.in.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 13 Feb 2014 08:30:27 +0530 From: "Aneesh Kumar K.V" In-Reply-To: <20140212154030.393.66279.stgit@bahia.local> References: <20140210162515.07e11909@bahia.local> <20140212154030.393.66279.stgit@bahia.local> Date: Thu, 13 Feb 2014 08:30:23 +0530 Message-ID: <87zjlvsomw.fsf@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH] target-ppc: fix warn_unused_result build break with in-kernel HTAB support List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Greg Kurz , agraf@suse.de Cc: qemu-ppc@nongnu.org, qemu-devel@nongnu.org Greg Kurz writes: > The 7029677e4 commit introduced the following build break: > > target-ppc/kvm.c: In function =E2=80=98kvmppc_hash64_write_pte=E2=80=99: > target-ppc/kvm.c:2017:10: error: ignoring return value of =E2=80=98write= =E2=80=99, declared > with attribute warn_unused_result [-Werror=3Dunused-result] > write(htab_fd, &hpte_buf, sizeof(hpte_buf)); > ^ > > Even though nothing is done for the moment if kvm_htab_write() fails, we > obviously need to be explicit. Let's add an *empty* return path to please > gcc. > Reviewed-by: Aneesh Kumar K.V > Signed-off-by: Greg Kurz > --- > target-ppc/kvm.c | 10 ++++++++-- > 1 file changed, 8 insertions(+), 2 deletions(-) > > diff --git a/target-ppc/kvm.c b/target-ppc/kvm.c > index 2eaf956..343376c 100644 > --- a/target-ppc/kvm.c > +++ b/target-ppc/kvm.c > @@ -2012,9 +2012,15 @@ void kvmppc_hash64_write_pte(CPUPPCState *env, tar= get_ulong pte_index, > hpte_buf.hpte[0] =3D pte0; > hpte_buf.hpte[1] =3D pte1; > /* > - * Write the hpte entry > + * Write the hpte entry. > + * CAUTION: write() has the warn_unused_result attribute. Hence we > + * need to check the return value, even though we do nothing. > */ > - write(htab_fd, &hpte_buf, sizeof(hpte_buf)); > + if (write(htab_fd, &hpte_buf, sizeof(hpte_buf)) < 0) { > + goto out_close; > + } > + > +out_close: > close(htab_fd); > return; >=20=20