On Wed, 26 Feb 2014 09:29:12 +0100
Christian Borntraeger <borntrae...@de.ibm.com> wrote:

> On 25/02/14 18:25, Cornelia Huck wrote:
> 
> > +int kvm_s390_io_adapter_map(uint32_t id, uint64_t map_addr, bool do_map)
> > +{
> > +    struct kvm_s390_io_adapter_req req = {
> > +        .id = id,
> > +        .type = do_map ? KVM_S390_IO_ADAPTER_MAP : 
> > KVM_S390_IO_ADAPTER_UNMAP,
> > +        .addr = map_addr,
> > +    };
> > +    KVMS390FLICState *flic = s390_get_flic();
> > +    struct kvm_device_attr attr;
> 
> Can we use designated initializer for attr, e.g.
>     struct kvm_device_attr attr = {
>         .group = KVM_DEV_FLIC_ADAPTER_MODIFY,
>         .addr = (uint64_t)&req,
>     }
> 
> > +    int r;
> > +
> > +    if (!flic) {
> > +        return -ENOSYS;
> > +    }
> > +    if (!kvm_check_extension(kvm_state, KVM_CAP_IRQ_ROUTING)) {
> > +        return -ENOSYS;
> > +    }
> > +
> > +    attr.group = KVM_DEV_FLIC_ADAPTER_MODIFY;
> > +    attr.addr = (uint64_t)&req;
> 
> and not do it here. That will zero out the other fields of attr.
> 
> Same for the register code.
> 

Hm, yes, I missed that. I'll change it for the next version.


Reply via email to