[PATCH] drm/amdkfd: Use logical AND operator (&&) instead of bitwise AND (&) with a bool operand
Srinivasan Shanmugam
srinivasan.shanmugam at amd.com
Thu Dec 21 02:42:39 UTC 2023
Doing a bitwise AND between a bool and an int is generally not a good
idea. The bool will be promoted to an int with value 0 or 1, the int is
generally regarded as true with a non-zero value, thus ANDing them using
bitwise has the potential to yield an undesired result.
Thus fixes the below:
drivers/gpu/drm/amd/amdgpu/../amdkfd/kfd_packet_manager_v9.c:117 pm_map_process_aldebaran() warn: maybe use && instead of &
Cc: Felix Kuehling <Felix.Kuehling at amd.com>
Cc: Christian König <christian.koenig at amd.com>
Cc: Alex Deucher <alexander.deucher at amd.com>
Signed-off-by: Srinivasan Shanmugam <srinivasan.shanmugam at amd.com>
---
drivers/gpu/drm/amd/amdkfd/kfd_packet_manager_v9.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_packet_manager_v9.c b/drivers/gpu/drm/amd/amdkfd/kfd_packet_manager_v9.c
index 8ee2bedd301a..da83deee45a7 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_packet_manager_v9.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_packet_manager_v9.c
@@ -114,7 +114,7 @@ static int pm_map_process_aldebaran(struct packet_manager *pm,
packet->tcp_watch_cntl[i] = pdd->watch_points[i];
packet->bitfields2.single_memops =
- !!(pdd->process->dbg_flags & KFD_DBG_TRAP_FLAG_SINGLE_MEM_OP);
+ !!(pdd->process->dbg_flags && KFD_DBG_TRAP_FLAG_SINGLE_MEM_OP);
}
packet->sh_mem_config = qpd->sh_mem_config;
--
2.34.1
More information about the amd-gfx
mailing list