]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
cxl/feature: Update out_len in set feature failure case
authorLi Ming <ming.li@zohomail.com>
Thu, 10 Apr 2025 02:45:21 +0000 (10:45 +0800)
committerDave Jiang <dave.jiang@intel.com>
Fri, 18 Apr 2025 16:33:56 +0000 (09:33 -0700)
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")
Signed-off-by: Li Ming <ming.li@zohomail.com>
Reviewed-by: Dave Jiang <dave.jiang@intel.com>
Reviewed-by: Ira Weiny <ira.weiny@intel.com>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Link: https://patch.msgid.link/20250410024521.514095-1-ming.li@zohomail.com
Signed-off-by: Dave Jiang <dave.jiang@intel.com>
drivers/cxl/core/features.c

index 150a1776480ab0002dd895697d23435a361108a2..1498e2369c37021fcac0186850b3d116e78cc700 100644 (file)
@@ -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);
 }