From: Shiju Jose Date: Wed, 17 Sep 2025 14:33:28 +0000 (+0100) Subject: hw/cxl/cxl-mailbox-utils: Move declaration of scrub and ECS feature attributes in... X-Git-Tag: v11.0.0-rc0~58^2~21 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d2c428ecd4b680456d759f78d8b8a18cffd00faf;p=thirdparty%2Fqemu.git 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 Signed-off-by: Jonathan Cameron Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin Message-Id: <20250917143330.294698-2-Jonathan.Cameron@huawei.com> --- diff --git a/hw/cxl/cxl-mailbox-utils.c b/hw/cxl/cxl-mailbox-utils.c index 125f417aa44..8b471c7d934 100644 --- a/hw/cxl/cxl-mailbox-utils.c +++ b/hw/cxl/cxl-mailbox-utils.c @@ -1351,10 +1351,6 @@ static CXLRetCode cmd_features_set_feature(const struct cxl_cmd *cmd, CXLCCI *cci) { CXLSetFeatureInHeader *hdr = (void *)payload_in; - CXLMemPatrolScrubWriteAttrs *ps_write_attrs; - CXLMemPatrolScrubSetFeature *ps_set_feature; - CXLMemECSWriteAttrs *ecs_write_attrs; - CXLMemECSSetFeature *ecs_set_feature; CXLSetFeatureInfo *set_feat_info; uint16_t bytes_to_copy = 0; uint8_t data_transfer_flag; @@ -1396,13 +1392,14 @@ static CXLRetCode cmd_features_set_feature(const struct cxl_cmd *cmd, } if (qemu_uuid_is_equal(&hdr->uuid, &patrol_scrub_uuid)) { + CXLMemPatrolScrubSetFeature *ps_set_feature = (void *)payload_in; + CXLMemPatrolScrubWriteAttrs *ps_write_attrs = + &ps_set_feature->feat_data; + if (hdr->version != CXL_MEMDEV_PS_SET_FEATURE_VERSION) { return CXL_MBOX_UNSUPPORTED; } - ps_set_feature = (void *)payload_in; - ps_write_attrs = &ps_set_feature->feat_data; - if ((uint32_t)hdr->offset + bytes_to_copy > sizeof(ct3d->patrol_scrub_wr_attrs)) { return CXL_MBOX_INVALID_PAYLOAD_LENGTH; @@ -1423,13 +1420,13 @@ static CXLRetCode cmd_features_set_feature(const struct cxl_cmd *cmd, } } else if (qemu_uuid_is_equal(&hdr->uuid, &ecs_uuid)) { + CXLMemECSSetFeature *ecs_set_feature = (void *)payload_in; + CXLMemECSWriteAttrs *ecs_write_attrs = ecs_set_feature->feat_data; + if (hdr->version != CXL_ECS_SET_FEATURE_VERSION) { return CXL_MBOX_UNSUPPORTED; } - ecs_set_feature = (void *)payload_in; - ecs_write_attrs = ecs_set_feature->feat_data; - if ((uint32_t)hdr->offset + bytes_to_copy > sizeof(ct3d->ecs_wr_attrs)) { return CXL_MBOX_INVALID_PAYLOAD_LENGTH;