Am 23.05.2012 17:44, schrieb Paolo Bonzini: > Range checking in PropertyInfo is now used only for pci_devfn > properties and some error reporting. Remove all code that implements > it in the various property types, and the now unused fields. > > Signed-off-by: Paolo Bonzini <pbonz...@redhat.com> > --- > hw/qdev-properties.c | 104 > ++++++++++++-------------------------------------- > hw/qdev.h | 2 - > 2 files changed, 24 insertions(+), 82 deletions(-) > > diff --git a/hw/qdev-properties.c b/hw/qdev-properties.c > index 2255ebb..af68ca5 100644 > --- a/hw/qdev-properties.c > +++ b/hw/qdev-properties.c [...] > @@ -924,10 +871,9 @@ static void set_blocksize(Object *obj, Visitor *v, void > *opaque, > error_propagate(errp, local_err); > return; > } > - if (value < prop->info->min || value > prop->info->max) { > + if (value < 512 || value > 32768) { > error_set(errp, QERR_PROPERTY_VALUE_OUT_OF_RANGE, > - dev->id?:"", name, (int64_t)value, prop->info->min, > - prop->info->max); > + dev->id?:"", name, (int64_t)value, 512L, 32768L); > return; > } >
This would need LL for 32-bit hosts. I've therefore adopted the same pattern as for the X86CPU properties, adding const int64_t min/max. This avoids duplicating the numbers between comparison and error message, and the comparison still compiles warning-free here despite uint16_t vs. int64_t. Applied to qom-next: http://repo.or.cz/w/qemu/afaerber.git/shortlog/refs/heads/qom-next For anyone wondering about the max change 65024 (1111 1110 0000 0000) to 32768 (1000 0000 0000 0000), there's a check following this one that allows only powers of 2. Andreas > @@ -945,8 +891,6 @@ PropertyInfo qdev_prop_blocksize = { > .name = "blocksize", > .get = get_uint16, > .set = set_blocksize, > - .min = 512, > - .max = 65024, > }; > > /* --- public helpers --- */ [snip] -- SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg