[PATCH] ufs/core: ufshcd: Conversion to bool not necessary

Bragatheswaran Manickavel posted 1 patch 2 years, 2 months ago
drivers/ufs/core/ufshcd.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] ufs/core: ufshcd: Conversion to bool not necessary
Posted by Bragatheswaran Manickavel 2 years, 2 months ago
A logical evaluation already results in bool. There is no need for using
a ternary operator based evaluation and bool conversion of the outcome.

Issue identified using boolconv.cocci Coccinelle semantic patch.

Signed-off-by: Bragatheswaran Manickavel <bragathemanick0908@gmail.com>
---
 drivers/ufs/core/ufshcd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
index 406885671665..bbd8e83be6c6 100644
--- a/drivers/ufs/core/ufshcd.c
+++ b/drivers/ufs/core/ufshcd.c
@@ -2406,7 +2406,7 @@ static inline bool ufshcd_ready_for_uic_cmd(struct ufs_hba *hba)
 	int ret = read_poll_timeout(ufshcd_readl, val, val & UIC_COMMAND_READY,
 				    500, UIC_CMD_TIMEOUT * 1000, false, hba,
 				    REG_CONTROLLER_STATUS);
-	return ret == 0 ? true : false;
+	return ret == 0;
 }
 
 /**
-- 
2.34.1
Re: [PATCH] ufs/core: ufshcd: Conversion to bool not necessary
Posted by Martin K. Petersen 2 years, 2 months ago
Bragatheswaran,

> A logical evaluation already results in bool. There is no need for
> using a ternary operator based evaluation and bool conversion of the
> outcome.

Applied to 6.7/scsi-staging, thanks!

-- 
Martin K. Petersen	Oracle Linux Engineering
Re: [PATCH] ufs/core: ufshcd: Conversion to bool not necessary
Posted by Bragatheswaran Manickavel 2 years, 2 months ago
On 25/10/23 08:14, Martin K. Petersen wrote:
> Bragatheswaran,
>
>> A logical evaluation already results in bool. There is no need for
>> using a ternary operator based evaluation and bool conversion of the
>> outcome.
> Applied to 6.7/scsi-staging, thanks!
>
Thanks Bart Van and Martin!
Re: [PATCH] ufs/core: ufshcd: Conversion to bool not necessary
Posted by Bart Van Assche 2 years, 2 months ago
On 10/24/23 11:34, Bragatheswaran Manickavel wrote:
> A logical evaluation already results in bool. There is no need for using
> a ternary operator based evaluation and bool conversion of the outcome.
> 
> Issue identified using boolconv.cocci Coccinelle semantic patch.
> 
> Signed-off-by: Bragatheswaran Manickavel <bragathemanick0908@gmail.com>
> ---
>   drivers/ufs/core/ufshcd.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
> index 406885671665..bbd8e83be6c6 100644
> --- a/drivers/ufs/core/ufshcd.c
> +++ b/drivers/ufs/core/ufshcd.c
> @@ -2406,7 +2406,7 @@ static inline bool ufshcd_ready_for_uic_cmd(struct ufs_hba *hba)
>   	int ret = read_poll_timeout(ufshcd_readl, val, val & UIC_COMMAND_READY,
>   				    500, UIC_CMD_TIMEOUT * 1000, false, hba,
>   				    REG_CONTROLLER_STATUS);
> -	return ret == 0 ? true : false;
> +	return ret == 0;
>   }

Reviewed-by: Bart Van Assche <bvanassche@acm.org>