From patchwork Tue Oct 30 17:03:53 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 149753 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp5725748ljp; Tue, 30 Oct 2018 10:05:08 -0700 (PDT) X-Google-Smtp-Source: AJdET5fxtz3DdgwloZbzPdevSPGaeC565OjX082ICwSRomg6I9E/l7LlEcxkD8X/qHMd8pYgMYOY X-Received: by 2002:a0c:be8d:: with SMTP id n13mr17483910qvi.143.1540919108333; Tue, 30 Oct 2018 10:05:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540919108; cv=none; d=google.com; s=arc-20160816; b=Sxv5QNN+UxMOMnZiadmEgT+K0SpPS/fc9rao0b5+6kXW8evrZytpIG2Mcn3+5I4hMy HytEMmhzhdFGNPdxVW9tcfEePUNKiZZ1TXuLdfVnUHn0IH3XyNTRPZkuV62XERZq424y B9uJiRIO/J3s/dCKG5xJcaHnHJgGevoNnx7KL31QnJ/dOrreQJJUsD0xwirLEhBUJ1h5 N/U1uesNcYIcJFcUnydjuORpKteids1bi1jz+SsTPsCz/FmFEyo/BXtNKhqtAYDcQZ7h jxNeqoBwL+k7hHL27UtBX0eEVNil30lrhUBzfLo0zwQ9ghIojhc1Znt16HRcGTWMOa9Z +r1g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject :content-transfer-encoding:mime-version:message-id:date:to:from; bh=PGuvX8GHxTxnp3WB2l5mVlixu57696keOYHgx97V4ms=; b=EVR1hb9ptd9UzvkQN80RpiLCqF1+fcfXd7Rns900HjCbc6cLkq3d91YEU0fcWYKw0d Mg2oAuOKNXXCZmk0sUEgFGWVRN9kK8rbsD75wYvbU9s5AAojgQYtxECItHR6OaP0B1xV BWhbF2TZuWwebMne9VrkyZAyATwxZQtr3oCM5NENlEcvkDLeAN0WzgGe9zt7yjyXHk1v ikqYZMrm6V3uO4o4vSa4HWU3bNTVjKyP6Cm+0qEoC8Vmy438W6yt3frccj0QPfYzNoU3 0g88rQh1Kha4Nz9yXnlomFZD0W5OhTckc9ARHdLGEKy3xRxYE057pzTZFt3mLq5HH8Bp 6Z4Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id d64-v6si20580607qka.107.2018.10.30.10.05.08 for (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 30 Oct 2018 10:05:08 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:54515 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gHXRz-0001eP-UR for patch@linaro.org; Tue, 30 Oct 2018 13:05:07 -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 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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Coverity points out in CID 1390588 that the test for sh == 0 in sdram_size() can never fire, because we calculate sh with sh = 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 --- 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(-) -- 2.19.1 Reviewed-by: Laurent Vivier 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; sh = 1024 - ((bcr >> 6) & 0x3ff); - if (sh == 0) { - size = -1; - } else { - size = 8 * MiB * sh; - } + size = 8 * MiB * sh; return size; }