From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56808) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cLv6Y-0004Je-LM for qemu-devel@nongnu.org; Tue, 27 Dec 2016 12:00:03 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cLv6V-0003Ed-FD for qemu-devel@nongnu.org; Tue, 27 Dec 2016 12:00:02 -0500 Received: from mail-yw0-x243.google.com ([2607:f8b0:4002:c05::243]:34283) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cLv6V-0003ET-AW for qemu-devel@nongnu.org; Tue, 27 Dec 2016 11:59:59 -0500 Received: by mail-yw0-x243.google.com with SMTP id a10so22762953ywa.1 for ; Tue, 27 Dec 2016 08:59:57 -0800 (PST) From: "=?UTF-8?q?Sergio=20Andr=C3=A9s=20G=C3=B3mez=20Del=20Real?=" Date: Tue, 27 Dec 2016 11:59:47 -0500 Message-Id: <20161227165947.20184-1-Sergio.G.DelReal@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Subject: [Qemu-devel] [PATCH] hw/dma: Fix dead code in pl080.c List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, =?UTF-8?q?Sergio=20Andr=C3=A9s=20G=C3=B3mez=20Del=20Real?= The patch fixes dead code in pl080_read() and pl080_write() as reported in bug #1637974. According to ARM's official Technical Reference Manual, offsets handled by the switch statement are 0x100, 0x104, 0x108, 0x10C and 0x110, so the solution suggested by the guy who reported the bug is right. Signed-off-by: Sergio Andrés Gómez Del Real --- hw/dma/pl080.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/dma/pl080.c b/hw/dma/pl080.c index 7724c93..8f34f24 100644 --- a/hw/dma/pl080.c +++ b/hw/dma/pl080.c @@ -255,7 +255,7 @@ static uint64_t pl080_read(void *opaque, hwaddr offset, i = (offset & 0xe0) >> 5; if (i >= s->nchannels) goto bad_offset; - switch (offset >> 2) { + switch ((offset-0x100) >> 2) { case 0: /* SrcAddr */ return s->chan[i].src; case 1: /* DestAddr */ @@ -316,7 +316,7 @@ static void pl080_write(void *opaque, hwaddr offset, i = (offset & 0xe0) >> 5; if (i >= s->nchannels) goto bad_offset; - switch (offset >> 2) { + switch ((offset-0x100) >> 2) { case 0: /* SrcAddr */ s->chan[i].src = value; break; -- 2.10.2