[PATCH v2 1/9] ufs: host: mediatek: Remove unnecessary boolean conversion

Bart Van Assche bvanassche at acm.org
Fri Jul 18 08:13:01 PDT 2025


On 7/18/25 2:51 AM, peter.wang at mediatek.com wrote:
> This patch removes unnecessary boolean conversions to ensure consistency
> with other usages in ufs-mediatek.c. The changes simplify the code by
> directly returning the result of bitwise operations without converting
> them to boolean values.

Hmm ... the conversion to boolean still happens but now happens 
implicitly (by the compiler) instead of explicitly (via !!).

> diff --git a/drivers/ufs/host/ufs-mediatek.c b/drivers/ufs/host/ufs-mediatek.c
> index 182f58d0c9db..14f0130da653 100644
> --- a/drivers/ufs/host/ufs-mediatek.c
> +++ b/drivers/ufs/host/ufs-mediatek.c
> @@ -96,28 +96,28 @@ static bool ufs_mtk_is_boost_crypt_enabled(struct ufs_hba *hba)
>   {
>   	struct ufs_mtk_host *host = ufshcd_get_variant(hba);
>   
> -	return !!(host->caps & UFS_MTK_CAP_BOOST_CRYPT_ENGINE);
> +	return (host->caps & UFS_MTK_CAP_BOOST_CRYPT_ENGINE);
>   }

How about removing the parentheses too since this patch makes the
parentheses unnecessary?

Otherwise this patch looks good to me.

Thanks,

Bart.




More information about the Linux-mediatek mailing list