Skip to contentSkip to conversation

cxl/feature: Update rpc_out in set feature failure case

PATCH Superseded Li Ming 1 participant 2 messages Apr 9, 2025 CXL

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Li Ming

author reviewer
#0 lore raw

PATCH 1/1 cxl/feature: Update rpc_out in set feature failure case

CXL subsystem supports userspace to configure component features via fwctl interface, it will configure features by using Set Feature command. Whatever Set Feature succeeds or fails, CXL subsystem always needs to return a structure fwctl_rpc_cxl_out to caller, and returned size is updated in a rpc_out parameter. The rpc_out is only updated in success case at this moment, it should also be updated in failure cases.

---
 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
author reviewer
#1 lore raw
Quoted 21 lines · Li Ming

CXL subsystem supports userspace to configure component features via fwctl interface, it will configure features by using Set Feature command. Whatever Set Feature succeeds or fails, CXL subsystem always needs to return a structure fwctl_rpc_cxl_out to caller, and returned size is updated in a rpc_out parameter. The rpc_out is only updated in success case at this moment, it should also be updated in failure cases.

---
 drivers/cxl/core/features.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/cxl/core/features.c +1 -0
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);

drivers/cxl/core/features.c static void *cxlctl_set_feature(struct cxl_features_state *cxlfs, · line 552

Quoted 10 lines
drivers/cxl/core/features.c +0 -1
 	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);
 }

Sorry, please ignore this patch, Wrong description in changelog, already send out v2 for review.

Ming