From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:54738) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RqLiW-0003s8-NF for qemu-devel@nongnu.org; Thu, 26 Jan 2012 04:34:06 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RqLiQ-0000Sf-VS for qemu-devel@nongnu.org; Thu, 26 Jan 2012 04:34:04 -0500 Received: from mx1.redhat.com ([209.132.183.28]:7620) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RqLiQ-0000SX-LB for qemu-devel@nongnu.org; Thu, 26 Jan 2012 04:33:58 -0500 From: Avi Kivity Date: Thu, 26 Jan 2012 11:33:31 +0200 Message-Id: <1327570411-20432-1-git-send-email-avi@redhat.com> Subject: [Qemu-devel] [PATCH] memory: fix return value on unassigned reads List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: atar4qemu@gmail.com Cc: Blue Swirl , qemu-devel@nongnu.org, chouteau@adacore.com The memory API returns -1 on unassigned reads, different from the original in exec.c, which returned zero. This breaks grlib_uart; apparently some users depend on it. Fix by returning zero; however if reading from the uart is legal, then it should be modified to accept reads. Signed-off-by: Avi Kivity --- memory.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/memory.c b/memory.c index ee4c98a..afc12dc 100644 --- a/memory.c +++ b/memory.c @@ -917,7 +917,7 @@ static uint64_t memory_region_dispatch_read1(MemoryRegion *mr, uint64_t data = 0; if (!memory_region_access_valid(mr, addr, size, false)) { - return -1U; /* FIXME: better signalling */ + return 0; /* FIXME: better signalling */ } if (!mr->ops->read) { -- 1.7.7.1