[PATCH] coresight: Fix dsb_mode_store() unsigned val is never less than zero

Pei Xiao posted 1 patch 1 year, 2 months ago
drivers/hwtracing/coresight/coresight-tpdm.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
[PATCH] coresight: Fix dsb_mode_store() unsigned val is never less than zero
Posted by Pei Xiao 1 year, 2 months ago
dsb_mode_store() warn: unsigned 'val' is never less than zero.

Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202410150702.UaZ7kvet-lkp@intel.com/
Fixes: 018e43ad1eee ("coresight-tpdm: Add node to set dsb programming mode")
Signed-off-by: Pei Xiao <xiaopei01@kylinos.cn>
---
 drivers/hwtracing/coresight/coresight-tpdm.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/hwtracing/coresight/coresight-tpdm.c b/drivers/hwtracing/coresight/coresight-tpdm.c
index b7d99e91ab84..158950243d83 100644
--- a/drivers/hwtracing/coresight/coresight-tpdm.c
+++ b/drivers/hwtracing/coresight/coresight-tpdm.c
@@ -640,8 +640,7 @@ static ssize_t dsb_mode_store(struct device *dev,
 	struct tpdm_drvdata *drvdata = dev_get_drvdata(dev->parent);
 	unsigned long val;
 
-	if ((kstrtoul(buf, 0, &val)) || (val < 0) ||
-			(val & ~TPDM_DSB_MODE_MASK))
+	if ((kstrtoul(buf, 0, &val)) || (val & ~TPDM_DSB_MODE_MASK))
 		return -EINVAL;
 
 	spin_lock(&drvdata->spinlock);
-- 
2.34.1
Re: [PATCH] coresight: Fix dsb_mode_store() unsigned val is never less than zero
Posted by Suzuki K Poulose 1 year, 1 month ago
On Thu, 21 Nov 2024 10:40:03 +0800, Pei Xiao wrote:
> dsb_mode_store() warn: unsigned 'val' is never less than zero.
> 
> 

Applied, thanks!

[1/1] coresight: Fix dsb_mode_store() unsigned val is never less than zero
      https://git.kernel.org/coresight/c/d4276259f3a57131291d879b53fc05863c6b59fa

Best regards,
-- 
Suzuki K Poulose <suzuki.poulose@arm.com>
Re: [PATCH] coresight: Fix dsb_mode_store() unsigned val is never less than zero
Posted by James Clark 1 year, 2 months ago

On 21/11/2024 2:40 am, Pei Xiao wrote:
> dsb_mode_store() warn: unsigned 'val' is never less than zero.
> 
> Reported-by: kernel test robot <lkp@intel.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202410150702.UaZ7kvet-lkp@intel.com/
> Fixes: 018e43ad1eee ("coresight-tpdm: Add node to set dsb programming mode")
> Signed-off-by: Pei Xiao <xiaopei01@kylinos.cn>
> ---
>   drivers/hwtracing/coresight/coresight-tpdm.c | 3 +--
>   1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/hwtracing/coresight/coresight-tpdm.c b/drivers/hwtracing/coresight/coresight-tpdm.c
> index b7d99e91ab84..158950243d83 100644
> --- a/drivers/hwtracing/coresight/coresight-tpdm.c
> +++ b/drivers/hwtracing/coresight/coresight-tpdm.c
> @@ -640,8 +640,7 @@ static ssize_t dsb_mode_store(struct device *dev,
>   	struct tpdm_drvdata *drvdata = dev_get_drvdata(dev->parent);
>   	unsigned long val;
>   
> -	if ((kstrtoul(buf, 0, &val)) || (val < 0) ||
> -			(val & ~TPDM_DSB_MODE_MASK))
> +	if ((kstrtoul(buf, 0, &val)) || (val & ~TPDM_DSB_MODE_MASK))
>   		return -EINVAL;
>   
>   	spin_lock(&drvdata->spinlock);

Reviewed-by: James Clark <james.clark@linaro.org>