From patchwork Tue Dec 27 23:11:56 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: 9489911 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 ED64060838 for ; Tue, 27 Dec 2016 23:12:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C42061FF1E for ; Tue, 27 Dec 2016 23:12:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B7A7B2094F; Tue, 27 Dec 2016 23:12:52 +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 410B11FF1E for ; Tue, 27 Dec 2016 23:12:51 +0000 (UTC) Received: from localhost ([::1]:56604 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cM0vI-0000Q7-S0 for patchwork-qemu-devel@patchwork.kernel.org; Tue, 27 Dec 2016 18:12:48 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45335) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cM0v3-0000Q0-JN for qemu-devel@nongnu.org; Tue, 27 Dec 2016 18:12:34 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cM0v0-00088f-Gk for qemu-devel@nongnu.org; Tue, 27 Dec 2016 18:12:33 -0500 Received: from mail-yw0-x244.google.com ([2607:f8b0:4002:c05::244]:35436) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cM0v0-00088Z-Bg for qemu-devel@nongnu.org; Tue, 27 Dec 2016 18:12:30 -0500 Received: by mail-yw0-x244.google.com with SMTP id b66so23366656ywh.2 for ; Tue, 27 Dec 2016 15:12:30 -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=/2Y5Q00ssPU1/gG88KBWF+MyxiZBy2r12Utgq3+NE6I=; b=IXI0SUErL6X02o2Q3y2tVgBLz1rOfWi5kbJRCFvCTWmKkix8kF+hz1lpMpKZfJeGB6 wfTzRWC6zTJqZ6PjoAYyRUr7V3XEwh0aFwHCt1SZiDRkaVg0iNlQ7YdqxAohsQti2Z+R 5R/+qvjaVTsIzRf1t5ixwNrxTQWqJaH2DTIxT2C7kUEoW6S7StsaPtsWqFALphYyOF38 1JQ/lgCX5Rt0Pvu3N6Lu72FrD1xqeDjrtFafArAOXbniiBOBVaMmK+1bCXpc82ZMxdn4 daCFN+MLeAeoE5KFWlH14372M3Jzb/1G+7a1cz2ggOMCaoKjK9f1KtWTgv4d+lv8OzeY /BJg== 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=/2Y5Q00ssPU1/gG88KBWF+MyxiZBy2r12Utgq3+NE6I=; b=cKys+C58AtgLd2fZuTpSR6/lQ4YgwPij4e0YrHdAJQP25sgInrigGm3j+X49YJzSe3 X9hxSTsV1cwPNXMyIBD0ALcKQfY2x89lYpJs2MbEtV3pF7oyeMaGcDsG0JVH9FfF/Rfj O0jzV3lcmnwogAcCHkxgEmpA6hVNtwecaIJvTT56tMjWA5gi8x9S6ScTEcmEupk79bXk RU4zbT80qKc0AEPJh3ManLVSjWH20DQFsyXWineXLL1cOBt2H0aRcLIaH3fnRvYieuQs Lsz+DcWy0APVoWZFRXyYS/lDehv530xtNHlypnwDBRND+I0wyyKVvV8YasC7dKjJELmW 8Sfg== X-Gm-Message-State: AIkVDXKIAXqnOv9xwiCX0VcdOSNhE5/jo9OadkT9y1s7LIHNzckXDDUTVzbcxmM4ZqkucQ== X-Received: by 10.129.68.5 with SMTP id r5mr23124419ywa.185.1482880349827; Tue, 27 Dec 2016 15:12:29 -0800 (PST) Received: from localhost.localdomain ([190.143.63.21]) by smtp.gmail.com with ESMTPSA id u1sm19597639ywc.15.2016.12.27.15.12.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 27 Dec 2016 15:12:28 -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 18:11:56 -0500 Message-Id: <20161227231156.22745-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::244 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..3b0c20b 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;