linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Suman Anna <s-anna@ti.com>
Cc: kbuild-all@lists.01.org, linux-kernel@vger.kernel.org,
	Bjorn Andersson <bjorn.andersson@linaro.org>,
	"Andrew F. Davis" <afd@ti.com>,
	Grzegorz Jaszczyk <grzegorz.jaszczyk@linaro.org>,
	Mathieu Poirier <mathieu.poirier@linaro.org>
Subject: drivers/remoteproc/pru_rproc.c:145 pru_d_da_to_va() warn: always true condition '(da >= 0) => (0-u32max >= 0)'
Date: Wed, 28 Jul 2021 21:23:18 +0800	[thread overview]
Message-ID: <202107282108.sQVWnkuL-lkp@intel.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 3331 bytes --]

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   7d549995d4e0d99b68e8a7793a0d23da6fc40fe8
commit: d4ce2de7e4af8b978eb816784d0eafc220336d52 remoteproc: pru: Add a PRU remoteproc driver
date:   8 months ago
config: arm64-randconfig-m031-20210728 (attached as .config)
compiler: aarch64-linux-gcc (GCC) 10.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

smatch warnings:
drivers/remoteproc/pru_rproc.c:145 pru_d_da_to_va() warn: always true condition '(da >= 0) => (0-u32max >= 0)'
drivers/remoteproc/pru_rproc.c:176 pru_i_da_to_va() warn: always true condition '(da >= 0) => (0-u32max >= 0)'

vim +145 drivers/remoteproc/pru_rproc.c

   118	
   119	/*
   120	 * Convert PRU device address (data spaces only) to kernel virtual address.
   121	 *
   122	 * Each PRU has access to all data memories within the PRUSS, accessible at
   123	 * different ranges. So, look through both its primary and secondary Data
   124	 * RAMs as well as any shared Data RAM to convert a PRU device address to
   125	 * kernel virtual address. Data RAM0 is primary Data RAM for PRU0 and Data
   126	 * RAM1 is primary Data RAM for PRU1.
   127	 */
   128	static void *pru_d_da_to_va(struct pru_rproc *pru, u32 da, size_t len)
   129	{
   130		struct pruss_mem_region dram0, dram1, shrd_ram;
   131		struct pruss *pruss = pru->pruss;
   132		u32 offset;
   133		void *va = NULL;
   134	
   135		if (len == 0)
   136			return NULL;
   137	
   138		dram0 = pruss->mem_regions[PRUSS_MEM_DRAM0];
   139		dram1 = pruss->mem_regions[PRUSS_MEM_DRAM1];
   140		/* PRU1 has its local RAM addresses reversed */
   141		if (pru->id == 1)
   142			swap(dram0, dram1);
   143		shrd_ram = pruss->mem_regions[PRUSS_MEM_SHRD_RAM2];
   144	
 > 145		if (da >= PRU_PDRAM_DA && da + len <= PRU_PDRAM_DA + dram0.size) {
   146			offset = da - PRU_PDRAM_DA;
   147			va = (__force void *)(dram0.va + offset);
   148		} else if (da >= PRU_SDRAM_DA &&
   149			   da + len <= PRU_SDRAM_DA + dram1.size) {
   150			offset = da - PRU_SDRAM_DA;
   151			va = (__force void *)(dram1.va + offset);
   152		} else if (da >= PRU_SHRDRAM_DA &&
   153			   da + len <= PRU_SHRDRAM_DA + shrd_ram.size) {
   154			offset = da - PRU_SHRDRAM_DA;
   155			va = (__force void *)(shrd_ram.va + offset);
   156		}
   157	
   158		return va;
   159	}
   160	
   161	/*
   162	 * Convert PRU device address (instruction space) to kernel virtual address.
   163	 *
   164	 * A PRU does not have an unified address space. Each PRU has its very own
   165	 * private Instruction RAM, and its device address is identical to that of
   166	 * its primary Data RAM device address.
   167	 */
   168	static void *pru_i_da_to_va(struct pru_rproc *pru, u32 da, size_t len)
   169	{
   170		u32 offset;
   171		void *va = NULL;
   172	
   173		if (len == 0)
   174			return NULL;
   175	
 > 176		if (da >= PRU_IRAM_DA &&
   177		    da + len <= PRU_IRAM_DA + pru->mem_regions[PRU_IOMEM_IRAM].size) {
   178			offset = da - PRU_IRAM_DA;
   179			va = (__force void *)(pru->mem_regions[PRU_IOMEM_IRAM].va +
   180					      offset);
   181		}
   182	
   183		return va;
   184	}
   185	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 36500 bytes --]

             reply	other threads:[~2021-07-28 13:23 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-28 13:23 kernel test robot [this message]
  -- strict thread matches above, loose matches on Subject: below --
2021-05-04 13:39 drivers/remoteproc/pru_rproc.c:145 pru_d_da_to_va() warn: always true condition '(da >= 0) => (0-u32max >= 0)' kernel test robot
2021-03-25 21:22 kernel test robot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202107282108.sQVWnkuL-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=afd@ti.com \
    --cc=bjorn.andersson@linaro.org \
    --cc=grzegorz.jaszczyk@linaro.org \
    --cc=kbuild-all@lists.01.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mathieu.poirier@linaro.org \
    --cc=s-anna@ti.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).