From patchwork Thu Nov 8 12:16:43 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Gibson X-Patchwork-Id: 150510 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp763630ljp; Thu, 8 Nov 2018 04:32:50 -0800 (PST) X-Google-Smtp-Source: AJdET5ewbRcXNLK9iNQiN90lp5bW81e17hkptyiQ3IHatjYd+iOnd3hB7Fd8Jb6zDQrciyNeAZKc X-Received: by 2002:ac8:1bda:: with SMTP id m26mr4106779qtk.239.1541680370317; Thu, 08 Nov 2018 04:32:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541680370; cv=none; d=google.com; s=arc-20160816; b=DDTiF186XwFN7pscQAFU6EIKdSXceZ08/41OJ7pxm0WmoPkz0wNPk2hpxQUSSvS+HS JYnwNJASxgi47AJo1mkd1sj/cle0NpwJkoz1kN/zCpKTH+bz5OIFfq/zjOQdv/Y+GyHO 9jkwTI7KRvZPRV7BdacSgaiWUXaT6JOgxU+ybtkd+nvk3R0I6dKnew8+UwP8q1/v5FZH ZL9zJhESNhCtxyuhSObSHYj/fazdasvlmO5lKcV84/c3kOLl6CckixRv5iKiCzhRiKpm h7ZD/Mwa68f8xE29pDJjj2DJTEMt8Sc34F2hkP+cPRfwWN7bk5M/1ZHQAw2ES+vkj71Q XGPQ== 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:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=NiEaQIwMT66Y+EliiTX0lCRr044rxA5GB3EhfQ5hu1g=; b=MW2ndJHEGXU2d5UYI+Z1frR4QOtjdY/VIQkxW5MD2giJIBdqt3KiQPCzOW5Gpvo/Qi 4ONKA/iB2YHrKy8l0yE+RDXbZtoMWlEx0zwl/UArFA3zHzp/eFzI2fwjOPXrlXmuqvUC okt6y4lKjTHA3iz3HZOUoFznxtKWYgN6eMNWZMumFdvRg/xvFfVfQAZBYair99bRp3wm u3vRO2FZDoU+Zl2APg6eyUQI8zubRU77EhFTrQmt523nFhvp/5JVms5JbJss3rn1yWDx B6w9f2J6RXBgnlTTa+CxZzttAdKSaAf8Y7FOuFvAGEYl49HSX3JEeV8xAAwAEKD/VVWm medg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gibson.dropbear.id.au header.s=201602 header.b=RAm2mVK1; 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" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id s64-v6si11616qkd.110.2018.11.08.04.32.50 for (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 08 Nov 2018 04:32:50 -0800 (PST) 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; dkim=neutral (body hash did not verify) header.i=@gibson.dropbear.id.au header.s=201602 header.b=RAm2mVK1; 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" Received: from localhost ([::1]:56338 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gKjUP-0000g8-Oz for patch@linaro.org; Thu, 08 Nov 2018 07:32:49 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43537) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gKjFP-0005Jz-22 for qemu-devel@nongnu.org; Thu, 08 Nov 2018 07:17:21 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gKjFN-0003zm-1V for qemu-devel@nongnu.org; Thu, 08 Nov 2018 07:17:18 -0500 Received: from ozlabs.org ([2401:3900:2:1::2]:47987) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gKjFM-0003kI-Gc; Thu, 08 Nov 2018 07:17:16 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 42rMj13jNQz9sLw; Thu, 8 Nov 2018 23:16:53 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1541679413; bh=r289fCdneoDMxCzgV1MnTiVzTf3yYVE9R2/iKt7jHtY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RAm2mVK1mOjPTsmVsNJCaDMqT+Tmv2d82rv7VMgLRIzQF9iDtChOTq08MiyvyOH8v oW+aR0Hg2Gbfp82CE8x5rc1i7yXQ4kLqlj26Ra6dNVfWMckghkyrCCuTwZymZ6IAHB 7rR1ApfiNEhMOmyYQK4EykDdnZ0FGrCGXzLNUf4g= From: David Gibson To: peter.maydell@linaro.org Date: Thu, 8 Nov 2018 23:16:43 +1100 Message-Id: <20181108121646.26173-20-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181108121646.26173-1-david@gibson.dropbear.id.au> References: <20181108121646.26173-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2401:3900:2:1::2 Subject: [Qemu-devel] [PULL 19/22] 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: lvivier@redhat.com, agraf@suse.de, qemu-devel@nongnu.org, groug@kaod.org, qemu-ppc@nongnu.org, David Gibson Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Peter Maydell 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 Reviewed-by: Laurent Vivier Signed-off-by: David Gibson --- hw/ppc/ppc440_uc.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) -- 2.19.1 diff --git a/hw/ppc/ppc440_uc.c b/hw/ppc/ppc440_uc.c index 09ccda548f..9360f781ce 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; }