Skip to contentSkip to conversation

cxl/feature: Update out_len in set feature failure case

PATCH Applied Li Ming 3 participants 3 messages Apr 10, 2025 – Apr 18, 2025 CXL

lore
Share & tools
lore

Li Ming

author reviewer
#0 lore raw

PATCH v3 1/1 cxl/feature: Update out_len in set feature failure case

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.

Fixes eb5dfcb9e36d ("cxl: Add support to handle user feature commands for set feature")

---
base-commit: 0af2f6be1b4281385b618cb86ad946eded089ac8 v6.15-rc1

v3:
- Add fixes tag
v2:
- Adjust changelog

---
 drivers/cxl/core/features.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/cxl/core/features.c +1 -1
index fcc624cefe89..63f24f032209 100644
@@ -540,13 +540,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);
 }
Signature · 1 line
2.34.1
Reviewed-by on v3 1/1
#1 lore raw
Quoted 11 lines · On Thu, 10 Apr 2025 10:45:21 +0800 Li Ming <[email protected]> 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.

Fixes eb5dfcb9e36d ("cxl: Add support to handle user feature commands for set feature")

Seems reasonable and well explained.

maintainer Applied
#2 lore raw
In reply to Li Ming
Quoted 11 lines · Li Ming

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.

Fixes eb5dfcb9e36d ("cxl: Add support to handle user feature commands for set feature")

Applied to cxl/fixes

Quoted 30 lines

---
base-commit: 0af2f6be1b4281385b618cb86ad946eded089ac8 v6.15-rc1

v3:
- Add fixes tag
v2:
- Adjust changelog

---
 drivers/cxl/core/features.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/cxl/core/features.c +1 -1
index fcc624cefe89..63f24f032209 100644
@@ -540,13 +540,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);
 }