From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55025) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zn5WO-00020g-9U for qemu-devel@nongnu.org; Fri, 16 Oct 2015 09:58:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zn5WM-0000lb-P9 for qemu-devel@nongnu.org; Fri, 16 Oct 2015 09:58:11 -0400 Received: from mnementh.archaic.org.uk ([2001:8b0:1d0::1]:35158) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zn5WM-0000ht-Hh for qemu-devel@nongnu.org; Fri, 16 Oct 2015 09:58:10 -0400 Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.80) (envelope-from ) id 1Zn5WJ-0003mZ-TT for qemu-devel@nongnu.org; Fri, 16 Oct 2015 14:58:07 +0100 From: Peter Maydell Date: Fri, 16 Oct 2015 14:58:02 +0100 Message-Id: <1445003887-14475-9-git-send-email-peter.maydell@linaro.org> In-Reply-To: <1445003887-14475-1-git-send-email-peter.maydell@linaro.org> References: <1445003887-14475-1-git-send-email-peter.maydell@linaro.org> Subject: [Qemu-devel] [PULL 08/13] misc: zynq_slcr: Fix MMIO writes List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org From: Peter Crosthwaite The /4 for offset calculation in MMIO writes was happening twice giving wrong write offsets. Fix. While touching the code, change the if-else to be a short returning if and convert the debug message to a GUEST_ERROR, which is more accurate for this condition. Cc: qemu-stable@nongnu.org Cc: Guenter Roeck Signed-off-by: Peter Crosthwaite Reviewed-by: Alistair Francis Signed-off-by: Peter Maydell --- hw/misc/zynq_slcr.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/hw/misc/zynq_slcr.c b/hw/misc/zynq_slcr.c index 964f253..3d78708 100644 --- a/hw/misc/zynq_slcr.c +++ b/hw/misc/zynq_slcr.c @@ -393,12 +393,12 @@ static void zynq_slcr_write(void *opaque, hwaddr offset, return; } - if (!s->regs[LOCKSTA]) { - s->regs[offset / 4] = val; - } else { - DB_PRINT("SCLR registers are locked. Unlock them first\n"); + if (s->regs[LOCKSTA]) { + qemu_log_mask(LOG_GUEST_ERROR, + "SCLR registers are locked. Unlock them first\n"); return; } + s->regs[offset] = val; switch (offset) { case PSS_RST_CTRL: -- 1.9.1