Received: by 2002:ac8:156:0:b0:3e0:cd10:60c8 with SMTP id f22csp2654681qtg; Tue, 4 Apr 2023 05:46:07 -0700 (PDT) X-Google-Smtp-Source: AKy350Z9XRbopGybBD5vuJRDSdUI/gbeWeKAh3zFpL3352SMLX+9kBypmMTKSGUiK0DZudBjLv6D X-Received: by 2002:a17:90b:1807:b0:234:b964:5708 with SMTP id lw7-20020a17090b180700b00234b9645708mr2694427pjb.5.1680612367050; Tue, 04 Apr 2023 05:46:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680612367; cv=none; d=google.com; s=arc-20160816; b=qbDAoiJtY800orgbfoKNvpFMILJVIiNk9VrA64qur9OIUhYJYJmZofRtCenEPehcbQ 6pk13okBno2gZSLxLg2H8j5o0IlOq5W033bxr+FQd1oJgvm0HCkLBmdotvGtaSdllE14 h3g16AQopviek3PGTzj//XGbvYjt5ZeuC+qToj85RqRxj75AvBAGYD+F//DM540gzlsB SNEb38INRcAzBaU6f8pzUpL/uiPQduZfIMmfJDfzoj0HR2q5L37nFZ0gETtLi4cydg2E EejnYXYb0fdFC24xlzcFNHCMhuaMvb0LclV8D75AGNwRisc+Dedu48dMfa8NFh4PSUwi rjFQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:message-id:content-transfer-encoding :mime-version:subject:date:from:dkim-signature; bh=Argvooh+YrRHFv3AlWAzvfKfjeSnRdHQ65WvVHRzWNk=; b=tshZJBkrSEuJGVXnSQrVDVq7OMH2a2A/y5RKmShesoRUFo+ZkBVa1XooeXUVnCdXEb c37Ha3+EbwcQTx5oqoM4qkzyjq5+nGZY7Vf6CJwDV6yrKo0L6nloSPgv4c1k5l4kh6uF YP/jFHmKFiVZ+NFSpgA1J6pKyDDitRizmpDsYMu0zuuu0XUE6SPFt3FcOrSEjKemhIxO 26GBbYsQqN/t4BV5wfrrJEKx4T2OWi3rdeUloWZgtGHnBhka3yAMW7CADxxSa704q9g0 rGGTwycEjNdqZDUSRl2eacOq/XawghG6B2FnEWC6kO8KCSVk/BWqt2+1YzcNR17GihNe kZ3Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=QZKS1I8y; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gj19-20020a17090b109300b00233e561533dsi14538862pjb.61.2023.04.04.05.45.50; Tue, 04 Apr 2023 05:46:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=QZKS1I8y; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235087AbjDDMpZ (ORCPT + 99 others); Tue, 4 Apr 2023 08:45:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40510 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235003AbjDDMpA (ORCPT ); Tue, 4 Apr 2023 08:45:00 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7ABBE93; Tue, 4 Apr 2023 05:44:59 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 1553463364; Tue, 4 Apr 2023 12:44:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 29EC1C433D2; Tue, 4 Apr 2023 12:44:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1680612298; bh=WFFW9qEQYe8+GiUD2bFU8d19Cj3lDDm8VtUlxAm+bH4=; h=From:Date:Subject:To:Cc:From; b=QZKS1I8yNLt22q8keAcuSLsiaXmUwcW3CtB65tSui+68PSR6a6y8o1zas3Gs6KBYc rvqMb8u37hnumuyK3xPVLSvPllfuT5Fsuv+zjtcScxUlKg/HbhG9jzCK2UjPatyL6L UyslQu58wAisIOZa8Rfhfr7mfefiGmO2aARQP/VgcsbBKKjnfDj/D6R7RHZywo8VbY oSzvoZkEh7vpAeSaKzWjpLV3/YonsqM1nVTWJup4TytlLQZ/sMx+InXEDhuN1vlsmA H+oYMa3j+iNycVjWMG9kK5wglimZUsSIxG1dNCzgD9q9Nka2204KAqSyBaaGI3UJ6h jPjSAF1FwG2Dg== From: Simon Horman Date: Tue, 04 Apr 2023 14:44:53 +0200 Subject: [PATCH] remoteproc: pru: remove always true check positive unsigned value MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20230404-pru-always-true-v1-1-b1b55eeff188@kernel.org> X-B4-Tracking: v=1; b=H4sIAMQbLGQC/x2N0QqDMAwAf0XyvEC1Vdh+Zewh1mwWSifJ6ibiv xv2eAfH7aAsiRVuzQ7Ca9L0LgbtpYE4U3kxpskYOtd5F1zARSpS/tKm+JHK2Psh9lNLwzV4sGo kZRyFSpytKzVnk4vwM/3+m/vjOE45xyw+dgAAAA== To: Bjorn Andersson , Mathieu Poirier Cc: Dan Carpenter , linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org, kernel test robot , Simon Horman X-Mailer: b4 0.12.2 X-Spam-Status: No, score=-2.5 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In both cases they type of da is u32. And PRU_PDRAM_DA is 0. So the check da >= PRU_PDRAM_DA is always true and can be removed. Flagged by Smatch: drivers/remoteproc/pru_rproc.c:660 pru_d_da_to_va() warn: always true condition '(da >= 0) => (0-u32max >= 0)' drivers/remoteproc/pru_rproc.c:709 pru_i_da_to_va() warn: always true condition '(da >= 0) => (0-u32max >= 0)' No functional changes intended. Compile tested only. Reported-by: kernel test robot Link: https://www.spinics.net/lists/kernel/msg4025983.html Signed-off-by: Simon Horman --- drivers/remoteproc/pru_rproc.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/remoteproc/pru_rproc.c b/drivers/remoteproc/pru_rproc.c index b76db7fa693d..095f66130f48 100644 --- a/drivers/remoteproc/pru_rproc.c +++ b/drivers/remoteproc/pru_rproc.c @@ -657,7 +657,7 @@ static void *pru_d_da_to_va(struct pru_rproc *pru, u32 da, size_t len) swap(dram0, dram1); shrd_ram = pruss->mem_regions[PRUSS_MEM_SHRD_RAM2]; - if (da >= PRU_PDRAM_DA && da + len <= PRU_PDRAM_DA + dram0.size) { + if (da + len <= PRU_PDRAM_DA + dram0.size) { offset = da - PRU_PDRAM_DA; va = (__force void *)(dram0.va + offset); } else if (da >= PRU_SDRAM_DA && @@ -706,8 +706,7 @@ static void *pru_i_da_to_va(struct pru_rproc *pru, u32 da, size_t len) */ da &= 0xfffff; - if (da >= PRU_IRAM_DA && - da + len <= PRU_IRAM_DA + pru->mem_regions[PRU_IOMEM_IRAM].size) { + if (da + len <= PRU_IRAM_DA + pru->mem_regions[PRU_IOMEM_IRAM].size) { offset = da - PRU_IRAM_DA; va = (__force void *)(pru->mem_regions[PRU_IOMEM_IRAM].va + offset);