From nobody Thu Nov 6 10:20:11 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1540919181491273.24607705388814; Tue, 30 Oct 2018 10:06:21 -0700 (PDT) Received: from localhost ([::1]:54523 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gHXTA-0002Ix-JP for importer@patchew.org; Tue, 30 Oct 2018 13:06:20 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35733) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gHXQx-0001DB-2M for qemu-devel@nongnu.org; Tue, 30 Oct 2018 13:04:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gHXQw-00010a-4K for qemu-devel@nongnu.org; Tue, 30 Oct 2018 13:04:02 -0400 Received: from orth.archaic.org.uk ([2001:8b0:1d0::2]:52156) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gHXQv-000106-SK; Tue, 30 Oct 2018 13:04:02 -0400 Received: from pm215 by orth.archaic.org.uk with local (Exim 4.89) (envelope-from ) id 1gHXQp-0001IQ-Sq; Tue, 30 Oct 2018 17:03:55 +0000 From: Peter Maydell To: qemu-devel@nongnu.org Date: Tue, 30 Oct 2018 17:03:53 +0000 Message-Id: <20181030170353.7447-1-peter.maydell@linaro.org> X-Mailer: git-send-email 2.19.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2001:8b0:1d0::2 Subject: [Qemu-devel] [PATCH for-3.1] hw/ppc/ppc440_uc: Remove dead code in sdram_size() 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: qemu-ppc@nongnu.org, Alexander Graf , David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Coverity points out in CID 1390588 that the test for sh =3D=3D 0 in sdram_size() can never fire, because we calculate sh with sh =3D 1024 - ((bcr >> 6) & 0x3ff); which must result in a value between 1 and 1024 inclusive. Without the relevant manual for the SoC, we're not completely sure of the correct behaviour here, but we can remove the dead code without changing how QEMU currently behaves. Signed-off-by: Peter Maydell Reviewed-by: Laurent Vivier --- We had a discussion about this coverity error a while back: https://lists.nongnu.org/archive/html/qemu-devel/2018-04/msg05187.html I'd just like to squash the Coverity warning, I think. hw/ppc/ppc440_uc.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/hw/ppc/ppc440_uc.c b/hw/ppc/ppc440_uc.c index 09ccda548f3..9360f781cef 100644 --- a/hw/ppc/ppc440_uc.c +++ b/hw/ppc/ppc440_uc.c @@ -559,11 +559,7 @@ static target_ulong sdram_size(uint32_t bcr) int sh; =20 sh =3D 1024 - ((bcr >> 6) & 0x3ff); - if (sh =3D=3D 0) { - size =3D -1; - } else { - size =3D 8 * MiB * sh; - } + size =3D 8 * MiB * sh; =20 return size; } --=20 2.19.1