* [PATCH][next] drm/ttm: remove redundant ternaray operation on ret
@ 2025-07-02 9:25 Colin Ian King
2025-07-02 9:42 ` Robert P. J. Day
0 siblings, 1 reply; 4+ messages in thread
From: Colin Ian King @ 2025-07-02 9:25 UTC (permalink / raw)
To: Christian Koenig, Huang Rui, Matthew Auld, Matthew Brost,
Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter, dri-devel
Cc: kernel-janitors, linux-kernel
Currently the only exit path to the end of the function
__ttm_bo_lru_cursor_next is when pointer res is NULL. The
ternary operation at the end of the function that checks on
the value of res is redundant as res can never be non-null
and hence the expression referencing pointer bo is never
executed. Clean up the code by replacing the ternary operator
with just a simple return of NULL
Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
---
drivers/gpu/drm/ttm/ttm_bo_util.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/ttm/ttm_bo_util.c b/drivers/gpu/drm/ttm/ttm_bo_util.c
index cdee664d2e8b..fb8bef50c744 100644
--- a/drivers/gpu/drm/ttm/ttm_bo_util.c
+++ b/drivers/gpu/drm/ttm/ttm_bo_util.c
@@ -1016,7 +1016,7 @@ __ttm_bo_lru_cursor_next(struct ttm_bo_lru_cursor *curs)
}
spin_unlock(lru_lock);
- return res ? bo : NULL;
+ return NULL;
}
/**
--
2.50.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH][next] drm/ttm: remove redundant ternaray operation on ret
2025-07-02 9:25 [PATCH][next] drm/ttm: remove redundant ternaray operation on ret Colin Ian King
@ 2025-07-02 9:42 ` Robert P. J. Day
2025-07-02 9:43 ` Colin King (gmail)
0 siblings, 1 reply; 4+ messages in thread
From: Robert P. J. Day @ 2025-07-02 9:42 UTC (permalink / raw)
To: Colin Ian King
Cc: Christian Koenig, Huang Rui, Matthew Auld, Matthew Brost,
Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter, dri-devel, kernel-janitors, linux-kernel
subject has typo, should be "ternary"
rday
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH][next] drm/ttm: remove redundant ternaray operation on ret
2025-07-02 9:42 ` Robert P. J. Day
@ 2025-07-02 9:43 ` Colin King (gmail)
2025-07-02 10:14 ` Christian König
0 siblings, 1 reply; 4+ messages in thread
From: Colin King (gmail) @ 2025-07-02 9:43 UTC (permalink / raw)
To: Robert P. J. Day
Cc: Christian Koenig, Huang Rui, Matthew Auld, Matthew Brost,
Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter, dri-devel, kernel-janitors, linux-kernel
[-- Attachment #1.1.1: Type: text/plain, Size: 208 bytes --]
On 02/07/2025 10:42, Robert P. J. Day wrote:
>
> subject has typo, should be "ternary"
>
> rday
Good catch. Can that be fixed up before applying the patch rather than
me sending a V2?
Colin
[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 4901 bytes --]
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH][next] drm/ttm: remove redundant ternaray operation on ret
2025-07-02 9:43 ` Colin King (gmail)
@ 2025-07-02 10:14 ` Christian König
0 siblings, 0 replies; 4+ messages in thread
From: Christian König @ 2025-07-02 10:14 UTC (permalink / raw)
To: Colin King (gmail), Robert P. J. Day
Cc: Huang Rui, Matthew Auld, Matthew Brost, Maarten Lankhorst,
Maxime Ripard, Thomas Zimmermann, David Airlie, Simona Vetter,
dri-devel, kernel-janitors, linux-kernel
On 02.07.25 11:43, Colin King (gmail) wrote:
> On 02/07/2025 10:42, Robert P. J. Day wrote:
>>
>> subject has typo, should be "ternary"
>>
>> rday
>
> Good catch. Can that be fixed up before applying the patch rather than me sending a V2?
Thomas or me can take care of that before pushing.
Christian.
>
> Colin
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-07-02 10:14 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-02 9:25 [PATCH][next] drm/ttm: remove redundant ternaray operation on ret Colin Ian King
2025-07-02 9:42 ` Robert P. J. Day
2025-07-02 9:43 ` Colin King (gmail)
2025-07-02 10:14 ` Christian König
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox