Greg Kurz <gk...@linux.vnet.ibm.com> writes: > The 7029677e4 commit introduced the following build break: > > target-ppc/kvm.c: In function ‘kvmppc_hash64_write_pte’: > target-ppc/kvm.c:2017:10: error: ignoring return value of ‘write’, declared > with attribute warn_unused_result [-Werror=unused-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 <aneesh.ku...@linux.vnet.ibm.com> > Signed-off-by: Greg Kurz <gk...@linux.vnet.ibm.com> > --- > 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, > target_ulong pte_index, > hpte_buf.hpte[0] = pte0; > hpte_buf.hpte[1] = 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; >