[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-ppc] [PATCH v1 08/11] pc-dimm: get_memory_region() will never
From: |
David Gibson |
Subject: |
Re: [Qemu-ppc] [PATCH v1 08/11] pc-dimm: get_memory_region() will never return a NULL pointer |
Date: |
Tue, 12 Jun 2018 11:12:34 +1000 |
User-agent: |
Mutt/1.10.0 (2018-05-17) |
On Mon, Jun 11, 2018 at 02:16:52PM +0200, David Hildenbrand wrote:
> This is guaranteed by passing into host_memory_backend_get_memory() a
> value that is not NULL - which is what we always do.
>
> Signed-off-by: David Hildenbrand <address@hidden>
Reviewed-by: David Gibson <address@hidden>
> ---
> hw/mem/pc-dimm.c | 15 ++-------------
> 1 file changed, 2 insertions(+), 13 deletions(-)
>
> diff --git a/hw/mem/pc-dimm.c b/hw/mem/pc-dimm.c
> index 7bb6ce509c..9a0da5d441 100644
> --- a/hw/mem/pc-dimm.c
> +++ b/hw/mem/pc-dimm.c
> @@ -157,7 +157,6 @@ static void pc_dimm_get_size(Object *obj, Visitor *v,
> const char *name,
> void *opaque, Error **errp)
> {
> uint64_t value;
> - MemoryRegion *mr;
> PCDIMMDevice *dimm = PC_DIMM(obj);
> PCDIMMDeviceClass *ddc = PC_DIMM_GET_CLASS(obj);
>
> @@ -167,11 +166,7 @@ static void pc_dimm_get_size(Object *obj, Visitor *v,
> const char *name,
> return;
> }
>
> - mr = ddc->get_memory_region(dimm);
> - if (!mr) {
> - return;
> - }
> - value = memory_region_size(mr);
> + value = memory_region_size(ddc->get_memory_region(dimm));
>
> visit_type_uint64(v, name, &value, errp);
> }
> @@ -241,14 +236,8 @@ static uint64_t pc_dimm_md_get_region_size(const
> MemoryDeviceState *md)
> /* dropping const here is fine as we don't touch the memory region */
> PCDIMMDevice *dimm = PC_DIMM(md);
> const PCDIMMDeviceClass *ddc = PC_DIMM_GET_CLASS(md);
> - MemoryRegion *mr;
> -
> - mr = ddc->get_memory_region(dimm);
> - if (!mr) {
> - return 0;
> - }
>
> - return memory_region_size(mr);
> + return memory_region_size(ddc->get_memory_region(dimm));
> }
>
> static void pc_dimm_md_fill_device_info(const MemoryDeviceState *md,
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
signature.asc
Description: PGP signature
- [Qemu-ppc] [PATCH v1 05/11] spapr: move memory hotplug size check into plug code, (continued)
[Qemu-ppc] [PATCH v1 04/11] hostmem: drop error variable from host_memory_backend_get_memory(), David Hildenbrand, 2018/06/11
[Qemu-ppc] [PATCH v1 08/11] pc-dimm: get_memory_region() will never return a NULL pointer, David Hildenbrand, 2018/06/11
- Re: [Qemu-ppc] [PATCH v1 08/11] pc-dimm: get_memory_region() will never return a NULL pointer,
David Gibson <=
[Qemu-ppc] [PATCH v1 09/11] pc-dimm: remove pc_dimm_get_vmstate_memory_region(), David Hildenbrand, 2018/06/11
[Qemu-ppc] [PATCH v1 07/11] pc-dimm: get_memory_region() can never fail, David Hildenbrand, 2018/06/11
- Re: [Qemu-ppc] [PATCH v1 07/11] pc-dimm: get_memory_region() can never fail, David Gibson, 2018/06/11
- Re: [Qemu-ppc] [Qemu-devel] [PATCH v1 07/11] pc-dimm: get_memory_region() can never fail, Igor Mammedov, 2018/06/13
- Re: [Qemu-ppc] [Qemu-devel] [PATCH v1 07/11] pc-dimm: get_memory_region() can never fail, David Hildenbrand, 2018/06/13
- Re: [Qemu-ppc] [Qemu-devel] [PATCH v1 07/11] pc-dimm: get_memory_region() can never fail, David Hildenbrand, 2018/06/13
- Re: [Qemu-ppc] [Qemu-devel] [PATCH v1 07/11] pc-dimm: get_memory_region() can never fail, Igor Mammedov, 2018/06/14
- Re: [Qemu-ppc] [Qemu-devel] [PATCH v1 07/11] pc-dimm: get_memory_region() can never fail, David Hildenbrand, 2018/06/14
- Re: [Qemu-ppc] [Qemu-devel] [PATCH v1 07/11] pc-dimm: get_memory_region() can never fail, Igor Mammedov, 2018/06/15