@samitouri / QOSamiQemu / commits / d2c428ecd4

hw/cxl/cxl-mailbox-utils: Move declaration of scrub and ECS feature attributes in cmd_features_set_feature()

Move the declaration of scrub and ECS feature attributes in cmd_features_set_feature() to the local scope where they are used. Signed-off-by: Shiju Jose <shiju.jose@huawei.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Message-Id: <20250917143330.294698-2-Jonathan.Cameron@huawei.com>

Shiju Jose committed Sep 17, 2025 at 15:33 UTC d2c428ecd4b680456d759f78d8b8a18cffd00faf
1 file changed +7 -10
hw/cxl/cxl-mailbox-utils.c
+7 -10
@@ -1351,10 +1351,6 @@ static CXLRetCode cmd_features_set_feature(const struct cxl_cmd *cmd,
1351 CXLCCI *cci)
1352 {
1353 CXLSetFeatureInHeader *hdr = (void *)payload_in;
1354 - CXLMemPatrolScrubWriteAttrs *ps_write_attrs;
1355 - CXLMemPatrolScrubSetFeature *ps_set_feature;
1356 - CXLMemECSWriteAttrs *ecs_write_attrs;
1357 - CXLMemECSSetFeature *ecs_set_feature;
1354 CXLSetFeatureInfo *set_feat_info;
1355 uint16_t bytes_to_copy = 0;
1356 uint8_t data_transfer_flag;
@@ -1396,13 +1392,14 @@ static CXLRetCode cmd_features_set_feature(const struct cxl_cmd *cmd,
1392 }
1393
1394 if (qemu_uuid_is_equal(&hdr->uuid, &patrol_scrub_uuid)) {
1395 + CXLMemPatrolScrubSetFeature *ps_set_feature = (void *)payload_in;
1396 + CXLMemPatrolScrubWriteAttrs *ps_write_attrs =
1397 + &ps_set_feature->feat_data;
1398 +
1399 if (hdr->version != CXL_MEMDEV_PS_SET_FEATURE_VERSION) {
1400 return CXL_MBOX_UNSUPPORTED;
1401 }
1402
1403 - ps_set_feature = (void *)payload_in;
1404 - ps_write_attrs = &ps_set_feature->feat_data;
1405 -
1403 if ((uint32_t)hdr->offset + bytes_to_copy >
1404 sizeof(ct3d->patrol_scrub_wr_attrs)) {
1405 return CXL_MBOX_INVALID_PAYLOAD_LENGTH;
@@ -1423,13 +1420,13 @@ static CXLRetCode cmd_features_set_feature(const struct cxl_cmd *cmd,
1420 }
1421 } else if (qemu_uuid_is_equal(&hdr->uuid,
1422 &ecs_uuid)) {
1423 + CXLMemECSSetFeature *ecs_set_feature = (void *)payload_in;
1424 + CXLMemECSWriteAttrs *ecs_write_attrs = ecs_set_feature->feat_data;
1425 +
1426 if (hdr->version != CXL_ECS_SET_FEATURE_VERSION) {
1427 return CXL_MBOX_UNSUPPORTED;
1428 }
1429
1430 - ecs_set_feature = (void *)payload_in;
1431 - ecs_write_attrs = ecs_set_feature->feat_data;
1432 -
1430 if ((uint32_t)hdr->offset + bytes_to_copy >
1431 sizeof(ct3d->ecs_wr_attrs)) {
1432 return CXL_MBOX_INVALID_PAYLOAD_LENGTH;