mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] cxl : fix cxlctl_validate_hw_command() warn: always true condition
@ 2025-04-07  3:41 xiaopeitux
  2025-04-07  6:10 ` Li Ming
  0 siblings, 1 reply; 2+ messages in thread
From: xiaopeitux @ 2025-04-07  3:41 UTC (permalink / raw)
  To: dave, jonathan.cameron, dave.jiang, alison.schofield,
	vishal.l.verma, ira.weiny, dan.j.williams, linux-cxl,
	linux-kernel
  Cc: Pei Xiao

From: Pei Xiao <xiaopei01@kylinos.cn>

smatch warnings:
    drivers/cxl/core/features.c:441 cxlctl_validate_hw_command()
    warn: always true condition '(scope >= 0) => (0-u32max >= 0)'

remove always true condition.

Signed-off-by: Pei Xiao <xiaopei01@kylinos.cn>
---
 drivers/cxl/core/features.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/cxl/core/features.c b/drivers/cxl/core/features.c
index f4daefe3180e..fdca93c984ce 100644
--- a/drivers/cxl/core/features.c
+++ b/drivers/cxl/core/features.c
@@ -616,9 +616,8 @@ static bool cxlctl_validate_hw_command(struct cxl_features_state *cxlfs,
 	case CXL_MBOX_OP_GET_FEATURE:
 		if (cxl_mbox->feat_cap < CXL_FEATURES_RO)
 			return false;
-		if (scope >= FWCTL_RPC_CONFIGURATION)
+		else
 			return true;
-		return false;
 	case CXL_MBOX_OP_SET_FEATURE:
 		if (cxl_mbox->feat_cap < CXL_FEATURES_RW)
 			return false;
-- 
2.25.1


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

* Re: [PATCH] cxl : fix cxlctl_validate_hw_command() warn: always true condition
  2025-04-07  3:41 [PATCH] cxl : fix cxlctl_validate_hw_command() warn: always true condition xiaopeitux
@ 2025-04-07  6:10 ` Li Ming
  0 siblings, 0 replies; 2+ messages in thread
From: Li Ming @ 2025-04-07  6:10 UTC (permalink / raw)
  To: xiaopeitux, Pei Xiao
  Cc: dave, jonathan.cameron, dave.jiang, alison.schofield,
	vishal.l.verma, ira.weiny, dan.j.williams, linux-cxl,
	linux-kernel

On 4/7/2025 11:41 AM, xiaopeitux@foxmail.com wrote:
> From: Pei Xiao <xiaopei01@kylinos.cn>
>
> smatch warnings:
>     drivers/cxl/core/features.c:441 cxlctl_validate_hw_command()
>     warn: always true condition '(scope >= 0) => (0-u32max >= 0)'
>
> remove always true condition.
>
> Signed-off-by: Pei Xiao <xiaopei01@kylinos.cn>
> ---
>  drivers/cxl/core/features.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/cxl/core/features.c b/drivers/cxl/core/features.c
> index f4daefe3180e..fdca93c984ce 100644
> --- a/drivers/cxl/core/features.c
> +++ b/drivers/cxl/core/features.c
> @@ -616,9 +616,8 @@ static bool cxlctl_validate_hw_command(struct cxl_features_state *cxlfs,
>  	case CXL_MBOX_OP_GET_FEATURE:
>  		if (cxl_mbox->feat_cap < CXL_FEATURES_RO)
>  			return false;
> -		if (scope >= FWCTL_RPC_CONFIGURATION)
> +		else
>  			return true;
> -		return false;
>  	case CXL_MBOX_OP_SET_FEATURE:
>  		if (cxl_mbox->feat_cap < CXL_FEATURES_RW)
>  			return false;

Already have a patch posted for this issue.

https://lore.kernel.org/linux-cxl/67f02de69d89c_9fe8529481@iweiny-mobl.notmuch/T/#m84c3093032b5eb167bbb1d0a787019d0387f4ae8


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

end of thread, other threads:[~2025-04-07  6:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-04-07  3:41 [PATCH] cxl : fix cxlctl_validate_hw_command() warn: always true condition xiaopeitux
2025-04-07  6:10 ` Li Ming

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®