[PATCH] drm/sti: Remove redundant ternary operators

Liao Yuanhong posted 1 patch 4 weeks ago
drivers/gpu/drm/sti/sti_hqvdp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] drm/sti: Remove redundant ternary operators
Posted by Liao Yuanhong 4 weeks ago
For ternary operators in the form of "a ? true : false", if 'a' itself
returns a boolean result, the ternary operator can be omitted. Remove
redundant ternary operators to clean up the code.

Signed-off-by: Liao Yuanhong <liaoyuanhong@vivo.com>
---
 drivers/gpu/drm/sti/sti_hqvdp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/sti/sti_hqvdp.c b/drivers/gpu/drm/sti/sti_hqvdp.c
index 03684062309b..b76606e9a82d 100644
--- a/drivers/gpu/drm/sti/sti_hqvdp.c
+++ b/drivers/gpu/drm/sti/sti_hqvdp.c
@@ -744,7 +744,7 @@ static bool sti_hqvdp_check_hw_scaling(struct sti_hqvdp *hqvdp,
 
 	inv_zy = DIV_ROUND_UP(src_h, dst_h);
 
-	return (inv_zy <= lfw) ? true : false;
+	return inv_zy <= lfw;
 }
 
 /**
-- 
2.34.1
Re: [PATCH] drm/sti: Remove redundant ternary operators
Posted by Raphael Gallais-Pou 3 weeks, 6 days ago

On 9/4/25 13:27, Liao Yuanhong wrote:
> For ternary operators in the form of "a ? true : false", if 'a' itself
> returns a boolean result, the ternary operator can be omitted. Remove
> redundant ternary operators to clean up the code.
>
> Signed-off-by: Liao Yuanhong <liaoyuanhong@vivo.com>
> ---
>
Hi,

Applied to drm-misc-next.

Best regards,
Raphaël
Re: [PATCH] drm/sti: Remove redundant ternary operators
Posted by Raphaël Gallais-Pou 4 weeks ago

Le 04/09/2025 à 13:27, Liao Yuanhong a écrit :
> For ternary operators in the form of "a ? true : false", if 'a' itself
> returns a boolean result, the ternary operator can be omitted. Remove
> redundant ternary operators to clean up the code.
> 
> Signed-off-by: Liao Yuanhong <liaoyuanhong@vivo.com>
> ---

Hi,

Acked-by: Raphaël Gallais-Pou <rgallaispou@gmail.com>

Thanks,
Best regards,
Raphaël