Skip to content

Commit 3a87fc6

Browse files
hormsmathieupoirier
authored andcommitted
remoteproc: pru: Remove always true check positive unsigned value
In both cases the 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 <lkp@intel.com> Link: https://www.spinics.net/lists/kernel/msg4025983.html Signed-off-by: Simon Horman <horms@kernel.org> Reviewed-by: Mukesh Ojha <quic_mojha@quicinc.com> Link: https://lore.kernel.org/r/20230404-pru-always-true-v1-1-b1b55eeff188@kernel.org [Fixed typo in changelog] Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
1 parent 96af01c commit 3a87fc6

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

drivers/remoteproc/pru_rproc.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -657,7 +657,7 @@ static void *pru_d_da_to_va(struct pru_rproc *pru, u32 da, size_t len)
657657
swap(dram0, dram1);
658658
shrd_ram = pruss->mem_regions[PRUSS_MEM_SHRD_RAM2];
659659

660-
if (da >= PRU_PDRAM_DA && da + len <= PRU_PDRAM_DA + dram0.size) {
660+
if (da + len <= PRU_PDRAM_DA + dram0.size) {
661661
offset = da - PRU_PDRAM_DA;
662662
va = (__force void *)(dram0.va + offset);
663663
} 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)
706706
*/
707707
da &= 0xfffff;
708708

709-
if (da >= PRU_IRAM_DA &&
710-
da + len <= PRU_IRAM_DA + pru->mem_regions[PRU_IOMEM_IRAM].size) {
709+
if (da + len <= PRU_IRAM_DA + pru->mem_regions[PRU_IOMEM_IRAM].size) {
711710
offset = da - PRU_IRAM_DA;
712711
va = (__force void *)(pru->mem_regions[PRU_IOMEM_IRAM].va +
713712
offset);

0 commit comments

Comments
 (0)