[PATCH] media: synopsys: hdmirx: media: Remove redundant ternary operators

Liao Yuanhong posted 1 patch 1 month, 1 week ago
drivers/media/platform/synopsys/hdmirx/snps_hdmirx.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] media: synopsys: hdmirx: media: Remove redundant ternary operators
Posted by Liao Yuanhong 1 month, 1 week 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/media/platform/synopsys/hdmirx/snps_hdmirx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/platform/synopsys/hdmirx/snps_hdmirx.c b/drivers/media/platform/synopsys/hdmirx/snps_hdmirx.c
index b7d278b3889f..c3007e09bc9f 100644
--- a/drivers/media/platform/synopsys/hdmirx/snps_hdmirx.c
+++ b/drivers/media/platform/synopsys/hdmirx/snps_hdmirx.c
@@ -237,7 +237,7 @@ static bool tx_5v_power_present(struct snps_hdmirx_dev *hdmirx_dev)
 			break;
 	}
 
-	ret = (cnt >= detection_threshold) ? true : false;
+	ret = cnt >= detection_threshold;
 	v4l2_dbg(3, debug, &hdmirx_dev->v4l2_dev, "%s: %d\n", __func__, ret);
 
 	return ret;
-- 
2.34.1
Re: [PATCH] media: synopsys: hdmirx: media: Remove redundant ternary operators
Posted by Dmitry Osipenko 1 month, 1 week ago
On 8/26/25 17:50, 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>
> ---
>  drivers/media/platform/synopsys/hdmirx/snps_hdmirx.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/media/platform/synopsys/hdmirx/snps_hdmirx.c b/drivers/media/platform/synopsys/hdmirx/snps_hdmirx.c
> index b7d278b3889f..c3007e09bc9f 100644
> --- a/drivers/media/platform/synopsys/hdmirx/snps_hdmirx.c
> +++ b/drivers/media/platform/synopsys/hdmirx/snps_hdmirx.c
> @@ -237,7 +237,7 @@ static bool tx_5v_power_present(struct snps_hdmirx_dev *hdmirx_dev)
>  			break;
>  	}
>  
> -	ret = (cnt >= detection_threshold) ? true : false;
> +	ret = cnt >= detection_threshold;
>  	v4l2_dbg(3, debug, &hdmirx_dev->v4l2_dev, "%s: %d\n", __func__, ret);
>  
>  	return ret;

Acked-by: Dmitry Osipenko <dmitry.osipenko@collabora.com>

-- 
Best regards,
Dmitry