All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] cxl: Remove always true condition for cxlctl_validate_hw_command()
@ 2025-04-04 16:54 Dave Jiang
  2025-04-04 17:08 ` Jonathan Cameron
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Dave Jiang @ 2025-04-04 16:54 UTC (permalink / raw)
  To: linux-cxl
  Cc: jonathan.cameron, dave, alison.schofield, ira.weiny,
	danj.williams, kernel test robot

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

Remove the check entirely as it has no effect. Expectation is both of these
operations should be allowed for all check levels. They are read only and
have no change effects.

Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202504041033.2HBboAZR-lkp@intel.com/
Signed-off-by: Dave Jiang <dave.jiang@intel.com>
---
 drivers/cxl/core/features.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/cxl/core/features.c b/drivers/cxl/core/features.c
index caf92e9cea21..594f290042e9 100644
--- a/drivers/cxl/core/features.c
+++ b/drivers/cxl/core/features.c
@@ -614,11 +614,7 @@ static bool cxlctl_validate_hw_command(struct cxl_features_state *cxlfs,
 	switch (opcode) {
 	case CXL_MBOX_OP_GET_SUPPORTED_FEATURES:
 	case CXL_MBOX_OP_GET_FEATURE:
-		if (cxl_mbox->feat_cap < CXL_FEATURES_RO)
-			return false;
-		if (scope >= FWCTL_RPC_CONFIGURATION)
-			return true;
-		return false;
+		return cxl_mbox->feat_cap >= CXL_FEATURES_RO;
 	case CXL_MBOX_OP_SET_FEATURE:
 		if (cxl_mbox->feat_cap < CXL_FEATURES_RW)
 			return false;
-- 
2.49.0


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

* Re: [PATCH] cxl: Remove always true condition for cxlctl_validate_hw_command()
  2025-04-04 16:54 [PATCH] cxl: Remove always true condition for cxlctl_validate_hw_command() Dave Jiang
@ 2025-04-04 17:08 ` Jonathan Cameron
  2025-04-04 19:07 ` Ira Weiny
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Jonathan Cameron @ 2025-04-04 17:08 UTC (permalink / raw)
  To: Dave Jiang
  Cc: linux-cxl, dave, alison.schofield, ira.weiny, danj.williams,
	kernel test robot

On Fri, 4 Apr 2025 09:54:18 -0700
Dave Jiang <dave.jiang@intel.com> wrote:

> smatch warnings:
> drivers/cxl/core/features.c:441 cxlctl_validate_hw_command() warn: always true condition '(scope >= 0) => (0-u32max >= 0)'
> 
> Remove the check entirely as it has no effect. Expectation is both of these
> operations should be allowed for all check levels. They are read only and
> have no change effects.
> 
> Reported-by: kernel test robot <lkp@intel.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202504041033.2HBboAZR-lkp@intel.com/
> Signed-off-by: Dave Jiang <dave.jiang@intel.com>

Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

> ---
>  drivers/cxl/core/features.c | 6 +-----
>  1 file changed, 1 insertion(+), 5 deletions(-)
> 
> diff --git a/drivers/cxl/core/features.c b/drivers/cxl/core/features.c
> index caf92e9cea21..594f290042e9 100644
> --- a/drivers/cxl/core/features.c
> +++ b/drivers/cxl/core/features.c
> @@ -614,11 +614,7 @@ static bool cxlctl_validate_hw_command(struct cxl_features_state *cxlfs,
>  	switch (opcode) {
>  	case CXL_MBOX_OP_GET_SUPPORTED_FEATURES:
>  	case CXL_MBOX_OP_GET_FEATURE:
> -		if (cxl_mbox->feat_cap < CXL_FEATURES_RO)
> -			return false;
> -		if (scope >= FWCTL_RPC_CONFIGURATION)
> -			return true;
> -		return false;
> +		return cxl_mbox->feat_cap >= CXL_FEATURES_RO;
>  	case CXL_MBOX_OP_SET_FEATURE:
>  		if (cxl_mbox->feat_cap < CXL_FEATURES_RW)
>  			return false;


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

* Re: [PATCH] cxl: Remove always true condition for cxlctl_validate_hw_command()
  2025-04-04 16:54 [PATCH] cxl: Remove always true condition for cxlctl_validate_hw_command() Dave Jiang
  2025-04-04 17:08 ` Jonathan Cameron
@ 2025-04-04 19:07 ` Ira Weiny
  2025-04-07  6:11 ` Li Ming
  2025-04-09 19:34 ` Dave Jiang
  3 siblings, 0 replies; 5+ messages in thread
From: Ira Weiny @ 2025-04-04 19:07 UTC (permalink / raw)
  To: Dave Jiang, linux-cxl
  Cc: jonathan.cameron, dave, alison.schofield, ira.weiny,
	danj.williams, kernel test robot

Dave Jiang wrote:
> smatch warnings:
> drivers/cxl/core/features.c:441 cxlctl_validate_hw_command() warn: always true condition '(scope >= 0) => (0-u32max >= 0)'
> 
> Remove the check entirely as it has no effect. Expectation is both of these
> operations should be allowed for all check levels. They are read only and
> have no change effects.
> 
> Reported-by: kernel test robot <lkp@intel.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202504041033.2HBboAZR-lkp@intel.com/
> Signed-off-by: Dave Jiang <dave.jiang@intel.com>

Reviewed-by: Ira Weiny <ira.weiny@intel.com>

[snip]

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

* Re: [PATCH] cxl: Remove always true condition for cxlctl_validate_hw_command()
  2025-04-04 16:54 [PATCH] cxl: Remove always true condition for cxlctl_validate_hw_command() Dave Jiang
  2025-04-04 17:08 ` Jonathan Cameron
  2025-04-04 19:07 ` Ira Weiny
@ 2025-04-07  6:11 ` Li Ming
  2025-04-09 19:34 ` Dave Jiang
  3 siblings, 0 replies; 5+ messages in thread
From: Li Ming @ 2025-04-07  6:11 UTC (permalink / raw)
  To: Dave Jiang
  Cc: jonathan.cameron, dave, alison.schofield, ira.weiny,
	danj.williams, kernel test robot, linux-cxl

On 4/5/2025 12:54 AM, Dave Jiang wrote:
> smatch warnings:
> drivers/cxl/core/features.c:441 cxlctl_validate_hw_command() warn: always true condition '(scope >= 0) => (0-u32max >= 0)'
>
> Remove the check entirely as it has no effect. Expectation is both of these
> operations should be allowed for all check levels. They are read only and
> have no change effects.
>
> Reported-by: kernel test robot <lkp@intel.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202504041033.2HBboAZR-lkp@intel.com/
> Signed-off-by: Dave Jiang <dave.jiang@intel.com>
Reviewed-by: Li Ming <ming.li@zohomail.com>

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

* Re: [PATCH] cxl: Remove always true condition for cxlctl_validate_hw_command()
  2025-04-04 16:54 [PATCH] cxl: Remove always true condition for cxlctl_validate_hw_command() Dave Jiang
                   ` (2 preceding siblings ...)
  2025-04-07  6:11 ` Li Ming
@ 2025-04-09 19:34 ` Dave Jiang
  3 siblings, 0 replies; 5+ messages in thread
From: Dave Jiang @ 2025-04-09 19:34 UTC (permalink / raw)
  To: linux-cxl
  Cc: jonathan.cameron, dave, alison.schofield, ira.weiny,
	danj.williams, kernel test robot



On 4/4/25 9:54 AM, Dave Jiang wrote:
> smatch warnings:
> drivers/cxl/core/features.c:441 cxlctl_validate_hw_command() warn: always true condition '(scope >= 0) => (0-u32max >= 0)'
> 
> Remove the check entirely as it has no effect. Expectation is both of these
> operations should be allowed for all check levels. They are read only and
> have no change effects.
> 
> Reported-by: kernel test robot <lkp@intel.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202504041033.2HBboAZR-lkp@intel.com/
> Signed-off-by: Dave Jiang <dave.jiang@intel.com>

Applied to cxl/next

> ---
>  drivers/cxl/core/features.c | 6 +-----
>  1 file changed, 1 insertion(+), 5 deletions(-)
> 
> diff --git a/drivers/cxl/core/features.c b/drivers/cxl/core/features.c
> index caf92e9cea21..594f290042e9 100644
> --- a/drivers/cxl/core/features.c
> +++ b/drivers/cxl/core/features.c
> @@ -614,11 +614,7 @@ static bool cxlctl_validate_hw_command(struct cxl_features_state *cxlfs,
>  	switch (opcode) {
>  	case CXL_MBOX_OP_GET_SUPPORTED_FEATURES:
>  	case CXL_MBOX_OP_GET_FEATURE:
> -		if (cxl_mbox->feat_cap < CXL_FEATURES_RO)
> -			return false;
> -		if (scope >= FWCTL_RPC_CONFIGURATION)
> -			return true;
> -		return false;
> +		return cxl_mbox->feat_cap >= CXL_FEATURES_RO;
>  	case CXL_MBOX_OP_SET_FEATURE:
>  		if (cxl_mbox->feat_cap < CXL_FEATURES_RW)
>  			return false;


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

end of thread, other threads:[~2025-04-09 19:34 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-04 16:54 [PATCH] cxl: Remove always true condition for cxlctl_validate_hw_command() Dave Jiang
2025-04-04 17:08 ` Jonathan Cameron
2025-04-04 19:07 ` Ira Weiny
2025-04-07  6:11 ` Li Ming
2025-04-09 19:34 ` Dave Jiang

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.