linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] coresight: tmc-etr: Assign boolean values to a bool variable
@ 2020-11-10  3:39 xiakaixu1987
  2020-11-10 17:56 ` Mathieu Poirier
  0 siblings, 1 reply; 2+ messages in thread
From: xiakaixu1987 @ 2020-11-10  3:39 UTC (permalink / raw)
  To: mathieu.poirier, suzuki.poulose, mike.leach
  Cc: coresight, linux-kernel, Kaixu Xia

From: Kaixu Xia <kaixuxia@tencent.com>

Fix the following coccinelle warnings:

./drivers/hwtracing/coresight/coresight-tmc-etr.c:957:2-15: WARNING: Assignment of 0/1 to bool variable

Fix them by assigning boolean values.

Reported-by: Tosk Robot <tencent_os_robot@tencent.com>
Signed-off-by: Kaixu Xia <kaixuxia@tencent.com>
---
 drivers/hwtracing/coresight/coresight-tmc-etr.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/hwtracing/coresight/coresight-tmc-etr.c b/drivers/hwtracing/coresight/coresight-tmc-etr.c
index 714f9e867e5f..525f0ecc129c 100644
--- a/drivers/hwtracing/coresight/coresight-tmc-etr.c
+++ b/drivers/hwtracing/coresight/coresight-tmc-etr.c
@@ -954,11 +954,11 @@ static void tmc_sync_etr_buf(struct tmc_drvdata *drvdata)
 		dev_dbg(&drvdata->csdev->dev,
 			"tmc memory error detected, truncating buffer\n");
 		etr_buf->len = 0;
-		etr_buf->full = 0;
+		etr_buf->full = false;
 		return;
 	}
 
-	etr_buf->full = status & TMC_STS_FULL;
+	etr_buf->full = !!(status & TMC_STS_FULL);
 
 	WARN_ON(!etr_buf->ops || !etr_buf->ops->sync);
 
-- 
2.20.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v2] coresight: tmc-etr: Assign boolean values to a bool variable
  2020-11-10  3:39 [PATCH v2] coresight: tmc-etr: Assign boolean values to a bool variable xiakaixu1987
@ 2020-11-10 17:56 ` Mathieu Poirier
  0 siblings, 0 replies; 2+ messages in thread
From: Mathieu Poirier @ 2020-11-10 17:56 UTC (permalink / raw)
  To: xiakaixu1987
  Cc: suzuki.poulose, mike.leach, coresight, linux-kernel, Kaixu Xia

On Tue, Nov 10, 2020 at 11:39:15AM +0800, xiakaixu1987@gmail.com wrote:
> From: Kaixu Xia <kaixuxia@tencent.com>
> 
> Fix the following coccinelle warnings:
> 
> ./drivers/hwtracing/coresight/coresight-tmc-etr.c:957:2-15: WARNING: Assignment of 0/1 to bool variable
> 
> Fix them by assigning boolean values.
> 
> Reported-by: Tosk Robot <tencent_os_robot@tencent.com>
> Signed-off-by: Kaixu Xia <kaixuxia@tencent.com>
> ---
>  drivers/hwtracing/coresight/coresight-tmc-etr.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

I have applied your patch.

Thanks,
Mathieu

> 
> diff --git a/drivers/hwtracing/coresight/coresight-tmc-etr.c b/drivers/hwtracing/coresight/coresight-tmc-etr.c
> index 714f9e867e5f..525f0ecc129c 100644
> --- a/drivers/hwtracing/coresight/coresight-tmc-etr.c
> +++ b/drivers/hwtracing/coresight/coresight-tmc-etr.c
> @@ -954,11 +954,11 @@ static void tmc_sync_etr_buf(struct tmc_drvdata *drvdata)
>  		dev_dbg(&drvdata->csdev->dev,
>  			"tmc memory error detected, truncating buffer\n");
>  		etr_buf->len = 0;
> -		etr_buf->full = 0;
> +		etr_buf->full = false;
>  		return;
>  	}
>  
> -	etr_buf->full = status & TMC_STS_FULL;
> +	etr_buf->full = !!(status & TMC_STS_FULL);
>  
>  	WARN_ON(!etr_buf->ops || !etr_buf->ops->sync);
>  
> -- 
> 2.20.0
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-11-10 17:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-10  3:39 [PATCH v2] coresight: tmc-etr: Assign boolean values to a bool variable xiakaixu1987
2020-11-10 17:56 ` Mathieu Poirier

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).