mirror of
https://gitlab.com/qemu-project/qemu
synced 2024-10-14 15:02:54 +00:00
hw/cxl: Use a switch to explicitly check size in caps_reg_read()
Bring this read function inline with the others that do check for unexpected size values. Also reduces line lengths to sub 80 chars. Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Fan Ni <fan.ni@samsung.com> Message-Id: <20231023140210.3089-2-Jonathan.Cameron@huawei.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
This commit is contained in:
parent
f58db4eeb1
commit
629df5cc23
|
@ -32,10 +32,13 @@ static uint64_t caps_reg_read(void *opaque, hwaddr offset, unsigned size)
|
||||||
{
|
{
|
||||||
CXLDeviceState *cxl_dstate = opaque;
|
CXLDeviceState *cxl_dstate = opaque;
|
||||||
|
|
||||||
if (size == 4) {
|
switch (size) {
|
||||||
return cxl_dstate->caps_reg_state32[offset / sizeof(*cxl_dstate->caps_reg_state32)];
|
case 4:
|
||||||
} else {
|
return cxl_dstate->caps_reg_state32[offset / size];
|
||||||
return cxl_dstate->caps_reg_state64[offset / sizeof(*cxl_dstate->caps_reg_state64)];
|
case 8:
|
||||||
|
return cxl_dstate->caps_reg_state64[offset / size];
|
||||||
|
default:
|
||||||
|
g_assert_not_reached();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue