The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH][next] drm/msm/a6xx: Remove logically deadcode in a6xx_preempt.c
@ 2024-10-11  5:23 Everest K.C.
  2024-10-11  8:19 ` Dan Carpenter
  0 siblings, 1 reply; 2+ messages in thread
From: Everest K.C. @ 2024-10-11  5:23 UTC (permalink / raw)
  To: robdclark, sean, konradybcio, quic_abhinavk, dmitry.baryshkov,
	marijn.suijten, airlied, simona
  Cc: Everest K.C., skhan, linux-arm-msm, dri-devel, freedreno,
	kernel-janitors, linux-kernel

The ternary operator never returns -1 as `ring` will never be NULL.
Thus, the ternary operator is not needed.
Fix this by removing the ternary operation and only including the
value it will return when the `ring` is not NULL.

This was reported by Coverity Scan.
https://scan7.scan.coverity.com/#/project-view/51525/11354?selectedIssue=1600286

Fixes: 35d36dc1692f ("drm/msm/a6xx: Add traces for preemption")
Signed-off-by: Everest K.C. <everestkc@everestkc.com.np>
---
 drivers/gpu/drm/msm/adreno/a6xx_preempt.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/msm/adreno/a6xx_preempt.c b/drivers/gpu/drm/msm/adreno/a6xx_preempt.c
index 6803d5af60cc..2fd4e39f618f 100644
--- a/drivers/gpu/drm/msm/adreno/a6xx_preempt.c
+++ b/drivers/gpu/drm/msm/adreno/a6xx_preempt.c
@@ -297,8 +297,7 @@ void a6xx_preempt_trigger(struct msm_gpu *gpu)
 	 */
 	ring->restore_wptr = false;
 
-	trace_msm_gpu_preemption_trigger(a6xx_gpu->cur_ring->id,
-		ring ? ring->id : -1);
+	trace_msm_gpu_preemption_trigger(a6xx_gpu->cur_ring->id, ring->id);
 
 	spin_unlock_irqrestore(&ring->preempt_lock, flags);
 
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH][next] drm/msm/a6xx: Remove logically deadcode in a6xx_preempt.c
  2024-10-11  5:23 [PATCH][next] drm/msm/a6xx: Remove logically deadcode in a6xx_preempt.c Everest K.C.
@ 2024-10-11  8:19 ` Dan Carpenter
  0 siblings, 0 replies; 2+ messages in thread
From: Dan Carpenter @ 2024-10-11  8:19 UTC (permalink / raw)
  To: Everest K.C.
  Cc: robdclark, sean, konradybcio, quic_abhinavk, dmitry.baryshkov,
	marijn.suijten, airlied, simona, skhan, linux-arm-msm, dri-devel,
	freedreno, kernel-janitors, linux-kernel

On Thu, Oct 10, 2024 at 11:23:14PM -0600, Everest K.C. wrote:
> The ternary operator never returns -1 as `ring` will never be NULL.
> Thus, the ternary operator is not needed.
> Fix this by removing the ternary operation and only including the
> value it will return when the `ring` is not NULL.
> 
> This was reported by Coverity Scan.
> https://scan7.scan.coverity.com/#/project-view/51525/11354?selectedIssue=1600286
> 
> Fixes: 35d36dc1692f ("drm/msm/a6xx: Add traces for preemption")
> Signed-off-by: Everest K.C. <everestkc@everestkc.com.np>
> ---

Reviewed-by: Dan Carpenter <dan.carpenter@linaro.org>

regards,
dan carpenter


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-10-11  8:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-11  5:23 [PATCH][next] drm/msm/a6xx: Remove logically deadcode in a6xx_preempt.c Everest K.C.
2024-10-11  8:19 ` Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox