diff mbox series

[v2,1/1] cxl/feature: Update out_len in set feature failure case

Message ID 20250409022521.510146-1-ming.li@zohomail.com
State Superseded
Headers show
Series [v2,1/1] cxl/feature: Update out_len in set feature failure case | expand

Commit Message

Li Ming April 9, 2025, 2:25 a.m. UTC
CXL subsystem supports userspace to configure features via fwctl
interface, it will configure features by using Set Feature command.
Whatever Set Feature succeeds or fails, CXL driver always needs to
return a structure fwctl_rpc_cxl_out to caller, and returned size is
updated in a out_len parameter. The out_len should be updated not only
when the set feature succeeds, but also when the set feature fails.

Signed-off-by: Li Ming <ming.li@zohomail.com>
---
base-commit: 0af2f6be1b4281385b618cb86ad946eded089ac8 v6.15-rc1

v2:
- Adjust changelog
---
 drivers/cxl/core/features.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Dave Jiang April 9, 2025, 3:37 p.m. UTC | #1
On 4/8/25 7:25 PM, Li Ming wrote:
> CXL subsystem supports userspace to configure features via fwctl
> interface, it will configure features by using Set Feature command.
> Whatever Set Feature succeeds or fails, CXL driver always needs to
> return a structure fwctl_rpc_cxl_out to caller, and returned size is
> updated in a out_len parameter. The out_len should be updated not only
> when the set feature succeeds, but also when the set feature fails.

Good catch! Can you add a Fixes tag please? Otherwise 
Reviewed-by: Dave Jiang <dave.jiang@intel.com>

> 
> Signed-off-by: Li Ming <ming.li@zohomail.com>
> ---
> base-commit: 0af2f6be1b4281385b618cb86ad946eded089ac8 v6.15-rc1
> 
> v2:
> - Adjust changelog
> ---
>  drivers/cxl/core/features.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/cxl/core/features.c b/drivers/cxl/core/features.c
> index f4daefe3180e..066dfc29a3dd 100644
> --- a/drivers/cxl/core/features.c
> +++ b/drivers/cxl/core/features.c
> @@ -528,13 +528,13 @@ static void *cxlctl_set_feature(struct cxl_features_state *cxlfs,
>  	rc = cxl_set_feature(cxl_mbox, &feat_in->uuid,
>  			     feat_in->version, feat_in->feat_data,
>  			     data_size, flags, offset, &return_code);
> +	*out_len = sizeof(*rpc_out);
>  	if (rc) {
>  		rpc_out->retval = return_code;
>  		return no_free_ptr(rpc_out);
>  	}
>  
>  	rpc_out->retval = CXL_MBOX_CMD_RC_SUCCESS;
> -	*out_len = sizeof(*rpc_out);
>  
>  	return no_free_ptr(rpc_out);
>  }
Ira Weiny April 9, 2025, 5:58 p.m. UTC | #2
Li Ming wrote:
> CXL subsystem supports userspace to configure features via fwctl
> interface, it will configure features by using Set Feature command.
> Whatever Set Feature succeeds or fails, CXL driver always needs to
> return a structure fwctl_rpc_cxl_out to caller, and returned size is
> updated in a out_len parameter. The out_len should be updated not only
> when the set feature succeeds, but also when the set feature fails.
> 
> Signed-off-by: Li Ming <ming.li@zohomail.com>
>

With fixes tag Dave found.

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

> ---
> base-commit: 0af2f6be1b4281385b618cb86ad946eded089ac8 v6.15-rc1
> 
> v2:
> - Adjust changelog
> ---
>  drivers/cxl/core/features.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/cxl/core/features.c b/drivers/cxl/core/features.c
> index f4daefe3180e..066dfc29a3dd 100644
> --- a/drivers/cxl/core/features.c
> +++ b/drivers/cxl/core/features.c
> @@ -528,13 +528,13 @@ static void *cxlctl_set_feature(struct cxl_features_state *cxlfs,
>  	rc = cxl_set_feature(cxl_mbox, &feat_in->uuid,
>  			     feat_in->version, feat_in->feat_data,
>  			     data_size, flags, offset, &return_code);
> +	*out_len = sizeof(*rpc_out);
>  	if (rc) {
>  		rpc_out->retval = return_code;
>  		return no_free_ptr(rpc_out);
>  	}
>  
>  	rpc_out->retval = CXL_MBOX_CMD_RC_SUCCESS;
> -	*out_len = sizeof(*rpc_out);
>  
>  	return no_free_ptr(rpc_out);
>  }
> -- 
> 2.34.1
>
Li Ming April 10, 2025, 1:02 a.m. UTC | #3
On 4/9/2025 11:37 PM, Dave Jiang wrote:
>
> On 4/8/25 7:25 PM, Li Ming wrote:
>> CXL subsystem supports userspace to configure features via fwctl
>> interface, it will configure features by using Set Feature command.
>> Whatever Set Feature succeeds or fails, CXL driver always needs to
>> return a structure fwctl_rpc_cxl_out to caller, and returned size is
>> updated in a out_len parameter. The out_len should be updated not only
>> when the set feature succeeds, but also when the set feature fails.
> Good catch! Can you add a Fixes tag please? Otherwise 
> Reviewed-by: Dave Jiang <dave.jiang@intel.com>、

Yes, forgot to add a Fixes tag. Thanks for that.


Ming

>
>> Signed-off-by: Li Ming <ming.li@zohomail.com>
>> ---
>> base-commit: 0af2f6be1b4281385b618cb86ad946eded089ac8 v6.15-rc1
>>
>> v2:
>> - Adjust changelog
>> ---
>>  drivers/cxl/core/features.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/cxl/core/features.c b/drivers/cxl/core/features.c
>> index f4daefe3180e..066dfc29a3dd 100644
>> --- a/drivers/cxl/core/features.c
>> +++ b/drivers/cxl/core/features.c
>> @@ -528,13 +528,13 @@ static void *cxlctl_set_feature(struct cxl_features_state *cxlfs,
>>  	rc = cxl_set_feature(cxl_mbox, &feat_in->uuid,
>>  			     feat_in->version, feat_in->feat_data,
>>  			     data_size, flags, offset, &return_code);
>> +	*out_len = sizeof(*rpc_out);
>>  	if (rc) {
>>  		rpc_out->retval = return_code;
>>  		return no_free_ptr(rpc_out);
>>  	}
>>  
>>  	rpc_out->retval = CXL_MBOX_CMD_RC_SUCCESS;
>> -	*out_len = sizeof(*rpc_out);
>>  
>>  	return no_free_ptr(rpc_out);
>>  }
diff mbox series

Patch

diff --git a/drivers/cxl/core/features.c b/drivers/cxl/core/features.c
index f4daefe3180e..066dfc29a3dd 100644
--- a/drivers/cxl/core/features.c
+++ b/drivers/cxl/core/features.c
@@ -528,13 +528,13 @@  static void *cxlctl_set_feature(struct cxl_features_state *cxlfs,
 	rc = cxl_set_feature(cxl_mbox, &feat_in->uuid,
 			     feat_in->version, feat_in->feat_data,
 			     data_size, flags, offset, &return_code);
+	*out_len = sizeof(*rpc_out);
 	if (rc) {
 		rpc_out->retval = return_code;
 		return no_free_ptr(rpc_out);
 	}
 
 	rpc_out->retval = CXL_MBOX_CMD_RC_SUCCESS;
-	*out_len = sizeof(*rpc_out);
 
 	return no_free_ptr(rpc_out);
 }