qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Sergio Andrés Gómez Del Real" <sergio.g.delreal@gmail.com>
To: qemu-devel@nongnu.org
Cc: peter.maydell@linaro.org,
	"Sergio Andrés Gómez Del Real" <Sergio.G.DelReal@gmail.com>
Subject: [Qemu-devel] [PATCH] hw/dma: Fix dead code in pl080.c
Date: Tue, 27 Dec 2016 11:59:47 -0500	[thread overview]
Message-ID: <20161227165947.20184-1-Sergio.G.DelReal@gmail.com> (raw)

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 <Sergio.G.DelReal@gmail.com>
---
 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

             reply	other threads:[~2016-12-27 17:00 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-27 16:59 Sergio Andrés Gómez Del Real [this message]
2016-12-27 20:30 ` [Qemu-devel] [PATCH] hw/dma: Fix dead code in pl080.c no-reply
  -- strict thread matches above, loose matches on Subject: below --
2016-12-27 23:11 Sergio Andrés Gómez Del Real
2017-01-05 11:47 ` Peter Maydell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20161227165947.20184-1-Sergio.G.DelReal@gmail.com \
    --to=sergio.g.delreal@gmail.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).