mirror_qemu/hw/mips
Markus Armbruster f26740c61a smbus: Fix spd_data_generate() error API violation
The Error ** argument must be NULL, &error_abort, &error_fatal, or a
pointer to a variable containing NULL.  Passing an argument of the
latter kind twice without clearing it in between is wrong: if the
first call sets an error, it no longer points to NULL for the second
call.

spd_data_generate() can pass @errp to error_setg() more than once when
it adjusts both memory size and type.  Harmless, because no caller
passes anything that needs adjusting.  Until the previous commit,
sam460ex passed types that needed adjusting, but not sizes.

spd_data_generate()'s contract is rather awkward:

    If everything's fine, return non-null and don't set an error.

    Else, if memory size or type need adjusting, return non-null and
    set an error describing the adjustment.

    Else, return null and set an error reporting why no data can be
    generated.

Its callers treat the error as a warning even when null is returned.
They don't create the "smbus-eeprom" device then.  Suspicious.

Since the previous commit, only "everything's fine" can actually
happen.  Drop the unused code and simplify the callers.  This gets rid
of the error API violation.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20200422134815.1584-3-armbru@redhat.com>
2020-04-29 08:01:52 +02:00
..
Kconfig hw/isa: Introduce a CONFIG_ISA_SUPERIO switch for isa-superio.c 2019-10-04 18:49:16 +02:00
Makefile.objs hw/mips/Makefile.objs: Create CONFIG_* for r4k, malta, mipssim boards 2019-02-05 16:50:19 +01:00
addr.c Include hw/hw.h exactly where needed 2019-08-16 13:31:52 +02:00
boston.c mips/boston: use memdev for RAM 2020-02-19 16:49:59 +00:00
cps.c qdev: set properties with device_class_set_props() 2020-01-24 20:59:15 +01:00
gt64xxx_pci.c hw: replace hw/i386/pc.h with a header just for the i8259 2019-12-17 19:33:49 +01:00
mips_fulong2e.c smbus: Fix spd_data_generate() error API violation 2020-04-29 08:01:52 +02:00
mips_int.c hw/mips/mips_int: Simplify cpu_mips_irq_init_cpu() 2020-02-27 14:18:31 +01:00
mips_jazz.c hw/mips: Use memory_region_init_rom() with read-only regions 2020-02-27 14:18:47 +01:00
mips_malta.c hw/ide: Do ide_drive_get() within pci_ide_create_devs() 2020-03-17 12:22:36 -04:00
mips_mipssim.c hw/mips: Use memory_region_init_rom() with read-only regions 2020-02-27 14:18:47 +01:00
mips_r4k.c hw/ide: Move MAX_IDE_DEVS define to hw/ide/internal.h 2020-03-17 12:22:36 -04:00
trace-events hw/mips/gt64xxx: Remove dynamic field width from trace events 2019-11-19 14:46:01 +01:00