From patchwork Tue Dec 27 16:59:47 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?UTF-8?q?Sergio=20Andr=C3=A9s=20G=C3=B3mez=20Del=20Real?= X-Patchwork-Id: 9489853 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 2CDA662AAD for ; Tue, 27 Dec 2016 20:27:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 091AC200E7 for ; Tue, 27 Dec 2016 20:27:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EEE2F2094F; Tue, 27 Dec 2016 20:27:14 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id AD07B200E7 for ; Tue, 27 Dec 2016 20:27:13 +0000 (UTC) Received: from localhost ([::1]:56055 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cLyL1-0000sl-0v for patchwork-qemu-devel@patchwork.kernel.org; Tue, 27 Dec 2016 15:27:11 -0500 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) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=aM0INHkOVIep89V93HEzNX/gW4w37c5DmRhnkt99oYU=; b=tn+DLLKn/tYSRu7xCEiemrgR5LiMByB3JIYgTQbQMU5CFttGhG6ihFXmVgygkhszX6 j+F+7SX7yUIFdRheD/izG24HucubJxj2U4U/OLqVRiUbcG2lqt4bAStPSPAFdGoXOwuJ t1FHCSDZ5ggNzF/Z4gNoMGRIfM2rzBvIefyJ8JZtvyK4CnnU70jiJGnncCOph7fleMQq 9pOn7QbT5OhQIeUB/TieGrWu7arhK6nmSlq4HwFMNWTvR+29lUZSt74XELMoWBJRTKET dYVjwvrE9Na1EpLMFWA7eDN9Q1XbcH23PjGaSvM9uKTqAZAcOYMoY7sCPjgJEtJD+MO7 Ckrg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=aM0INHkOVIep89V93HEzNX/gW4w37c5DmRhnkt99oYU=; b=kB3rB1ODtVrCXDYINz7tL7pXQXzE1Z7C4/510R2kEEZvIxg//OO+3AAZDgvzDZ9XJ2 gAY9Mw/RYSJ2JAbXQFvKjfvfvfqdPUGtctPrcqyz43W6bpgeRbYcx5OIKGOgvMJgRRJS e0zm85oqzLDiQauM36bN4obHfcN92YSrALpjX056CwYSj9cFLLC/RnZYi9CW91SOeAjl WiMmSktlqujNd1XpaplS9XYRCgMOAlkg9oXiHzKV7rVU/ohkFW/3uh8dJLkGUzdrBUTb h2SO0cT9Je4aWptZxI8IAbpT9QLiNe794O+x2mMFi1BHyqDGqX7WzYtX0jal46SikG5N Epog== X-Gm-Message-State: AIkVDXKDN6cC9mjiIkH5vb+TnibPFz9jd7+Y9sKd0PCPHY7KK22CGLjjwCdxn4QFSSlaZg== X-Received: by 10.129.62.24 with SMTP id l24mr24805273ywa.346.1482857997149; Tue, 27 Dec 2016 08:59:57 -0800 (PST) Received: from localhost.localdomain ([190.143.63.21]) by smtp.gmail.com with ESMTPSA id l31sm1480926ywh.37.2016.12.27.08.59.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 27 Dec 2016 08:59:56 -0800 (PST) From: "=?UTF-8?q?Sergio=20Andr=C3=A9s=20G=C3=B3mez=20Del=20Real?=" X-Google-Original-From: =?UTF-8?q?Sergio=20Andr=C3=A9s=20G=C3=B3mez=20Del=20Real?= To: qemu-devel@nongnu.org Date: Tue, 27 Dec 2016 11:59:47 -0500 Message-Id: <20161227165947.20184-1-Sergio.G.DelReal@gmail.com> X-Mailer: git-send-email 2.10.2 MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:4002:c05::243 X-Mailman-Approved-At: Tue, 27 Dec 2016 15:25:24 -0500 Subject: [Qemu-devel] [PATCH] hw/dma: Fix dead code in pl080.c X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Sergio=20Andr=C3=A9s=20G=C3=B3mez=20Del=20Real?= , peter.maydell@linaro.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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;