From patchwork Mon Jun 29 14:04:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 11630991 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 26EAE912 for ; Mon, 29 Jun 2020 14:07:24 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E736223D99 for ; Mon, 29 Jun 2020 14:07:23 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="Xl0y+PWq"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="mExcRW14" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E736223D99 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=O4jBKwGOC1ptHq862j3I1/xHTL5qA0qH53Bc/MUpy8Y=; b=Xl0y+PWqFjWgf48wen1oFnooq YmuwFUm+6UyzGkTYtoX4+wIQKZlqpFRYi35lyQC2ptEQv8tL7UE9/sxtrsf1lVsPaU4wO3t5LTZED SSXDFMw3XGac4xhG1xn+LtASrM7iQiy3LYjVlveSdfh4qurJV8MsxYY5HS4L56lGaAHYLHGPcyMiY Q0o20oMMy5HScZ0smVmN4kIzq7Xh9AbB36RMOM3nXNXfs9eYu8nvNoPzzpQmLYd524piWhKJjrrko Xq/mBgaT6am4YUI8eeiL10RcShWDwutTaRilsw3SjKZ4Zk9xuoXNOvo3F6fs0uHJCxg/rDnNb1NeZ 9Uhg3bzhA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jpuPf-0004QB-9p; Mon, 29 Jun 2020 14:05:35 +0000 Received: from mail-wr1-x441.google.com ([2a00:1450:4864:20::441]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jpuP0-0004De-Jh for linux-arm-kernel@lists.infradead.org; Mon, 29 Jun 2020 14:04:56 +0000 Received: by mail-wr1-x441.google.com with SMTP id s10so16639118wrw.12 for ; Mon, 29 Jun 2020 07:04:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=eCTcGJHtSmaPBnZUOms/69xtZG01NEK1s+KL4aDek/0=; b=mExcRW14yTqdrE+npdERL83UBRuofRErdA5/zgO3vl9BxrfDKDkoQbWF20CyrH2IUS 8UGyTrSsNjnnKbfg/JmvpnQmPPE+9II9m4mQ1g3abKPLo/CHKonJEB9B2KyTk40TL7zZ wJelDv5eKmyMI8SV1t20g5eXswq7iBjDP7X11tsetirsv9dUe16SDowmC7QpfiHTMG+x XvDbt0wa3fLD8MJ8wtrAGo1AQyLuSl7AIsI5m7XxErYSsKc6UKyp0O771NkG9DgFhEm6 NN/AlfVVuxiSc3efXqK8IquWgOi6l6dGg0dGxvvifTk7+/navEyuFGkz6eRr2WYZVKZy IMow== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=eCTcGJHtSmaPBnZUOms/69xtZG01NEK1s+KL4aDek/0=; b=ca534GR9VKZz7g6wgD3+1IuVBEMqemrhB0Tk7Tls6E5a1R0UmQtvehCcF66qqL8Zta /kPAVDY89a8HLZiKejQb1b1m+W0YsDaHOwgIRT/TkxJRjLB28rQ7qtyr3ADimiB4EzHe Q+C55fPSsJmb5aPPfE1eTLXIi635LBfHTU8cINIIGb6PeKFz+p6G7N4fFHWA/ogp5DPh pTEp1bw1tOMBnZcCBUhdx50ZNl0RT9vxXx2tkhYzBd+RX7XIZF2eLrsrGe83mHR+Dlvh Zq6bpKn/denf3TxnxbLQhv4fjKW/g5NpZaL47JDD+IgFwyAkfPopH+lcdppo3Vown6O5 ZTDw== X-Gm-Message-State: AOAM5334Fga8ngW1UwTBPm2tatDYg1A1WCeJJWXr57584Fdah8f8trbG YQkylpzjHdUBdRcIywfz9Ue4eA== X-Google-Smtp-Source: ABdhPJygUbnUrJAbW4jXvLREPQuFQ/kwh1F2Ffox4kxTw9ORCJFsMC95XOvyQ46XY78Axn7iLPLN1w== X-Received: by 2002:a5d:6846:: with SMTP id o6mr17264874wrw.370.1593439493674; Mon, 29 Jun 2020 07:04:53 -0700 (PDT) Received: from localhost.localdomain ([2.27.35.144]) by smtp.gmail.com with ESMTPSA id p14sm15394928wrj.14.2020.06.29.07.04.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Jun 2020 07:04:53 -0700 (PDT) From: Lee Jones To: arnd@arndb.de, gregkh@linuxfoundation.org Subject: [PATCH 06/20] misc: habanalabs: goya: Omit pointless check ensuring addr is >=0 Date: Mon, 29 Jun 2020 15:04:28 +0100 Message-Id: <20200629140442.1043957-7-lee.jones@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200629140442.1043957-1-lee.jones@linaro.org> References: <20200629140442.1043957-1-lee.jones@linaro.org> MIME-Version: 1.0 X-Spam-Note: CRM114 invocation failed X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:441 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Oded Gabbay , Tomer Tayar , Lee Jones , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Seeing as 'addr' is unsigned, it would be impossible for the assigned value to be anything other than zero or positive. Squashes the following W=1 warnings: drivers/misc/habanalabs/goya/goya.c: In function ‘goya_debugfs_read32’: drivers/misc/habanalabs/goya/goya.c:3945:19: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits] 3945 | } else if ((addr >= DRAM_PHYS_BASE) && | ^~ drivers/misc/habanalabs/goya/goya.c: In function ‘goya_debugfs_write32’: drivers/misc/habanalabs/goya/goya.c:4002:19: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits] 4002 | } else if ((addr >= DRAM_PHYS_BASE) && | ^~ drivers/misc/habanalabs/goya/goya.c: In function ‘goya_debugfs_read64’: drivers/misc/habanalabs/goya/goya.c:4047:19: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits] 4047 | } else if ((addr >= DRAM_PHYS_BASE) && | ^~ drivers/misc/habanalabs/goya/goya.c: In function ‘goya_debugfs_write64’: drivers/misc/habanalabs/goya/goya.c:4091:19: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits] 4091 | } else if ((addr >= DRAM_PHYS_BASE) && | ^~ drivers/misc/habanalabs/pci.c:328: warning: Excess function parameter 'dma_mask' description in 'hl_pci_set_dma_mask' drivers/misc/habanalabs/goya/goya_coresight.c: In function ‘goya_debug_coresight’: drivers/misc/habanalabs/goya/goya_coresight.c:643:6: warning: variable ‘val’ set but not used [-Wunused-but-set-variable] 643 | u32 val; | ^~~ Cc: Oded Gabbay Cc: Tomer Tayar Signed-off-by: Lee Jones Reviewed-by: Oded Gabbay --- drivers/misc/habanalabs/goya/goya.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/drivers/misc/habanalabs/goya/goya.c b/drivers/misc/habanalabs/goya/goya.c index 0d2952bb58dfb..a4a20e27ed3b4 100644 --- a/drivers/misc/habanalabs/goya/goya.c +++ b/drivers/misc/habanalabs/goya/goya.c @@ -3942,8 +3942,7 @@ static int goya_debugfs_read32(struct hl_device *hdev, u64 addr, u32 *val) *val = readl(hdev->pcie_bar[SRAM_CFG_BAR_ID] + (addr - SRAM_BASE_ADDR)); - } else if ((addr >= DRAM_PHYS_BASE) && - (addr < DRAM_PHYS_BASE + hdev->asic_prop.dram_size)) { + } else if (addr < DRAM_PHYS_BASE + hdev->asic_prop.dram_size) { u64 bar_base_addr = DRAM_PHYS_BASE + (addr & ~(prop->dram_pci_bar_size - 0x1ull)); @@ -3999,8 +3998,7 @@ static int goya_debugfs_write32(struct hl_device *hdev, u64 addr, u32 val) writel(val, hdev->pcie_bar[SRAM_CFG_BAR_ID] + (addr - SRAM_BASE_ADDR)); - } else if ((addr >= DRAM_PHYS_BASE) && - (addr < DRAM_PHYS_BASE + hdev->asic_prop.dram_size)) { + } else if (addr < DRAM_PHYS_BASE + hdev->asic_prop.dram_size) { u64 bar_base_addr = DRAM_PHYS_BASE + (addr & ~(prop->dram_pci_bar_size - 0x1ull)); @@ -4044,9 +4042,8 @@ static int goya_debugfs_read64(struct hl_device *hdev, u64 addr, u64 *val) *val = readq(hdev->pcie_bar[SRAM_CFG_BAR_ID] + (addr - SRAM_BASE_ADDR)); - } else if ((addr >= DRAM_PHYS_BASE) && - (addr <= - DRAM_PHYS_BASE + hdev->asic_prop.dram_size - sizeof(u64))) { + } else if (addr <= + DRAM_PHYS_BASE + hdev->asic_prop.dram_size - sizeof(u64)) { u64 bar_base_addr = DRAM_PHYS_BASE + (addr & ~(prop->dram_pci_bar_size - 0x1ull)); @@ -4088,9 +4085,8 @@ static int goya_debugfs_write64(struct hl_device *hdev, u64 addr, u64 val) writeq(val, hdev->pcie_bar[SRAM_CFG_BAR_ID] + (addr - SRAM_BASE_ADDR)); - } else if ((addr >= DRAM_PHYS_BASE) && - (addr <= - DRAM_PHYS_BASE + hdev->asic_prop.dram_size - sizeof(u64))) { + } else if (addr <= + DRAM_PHYS_BASE + hdev->asic_prop.dram_size - sizeof(u64)) { u64 bar_base_addr = DRAM_PHYS_BASE + (addr & ~(prop->dram_pci_bar_size - 0x1ull));