qemu-patch-raspberry4/hw/i2c
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
..
aspeed_i2c.c aspeed/i2c: Prevent uninitialized warning 2020-02-06 11:13:24 +01:00
bitbang_i2c.c Include hw/hw.h exactly where needed 2019-08-16 13:31:52 +02:00
core.c qdev: set properties with device_class_set_props() 2020-01-24 20:59:15 +01:00
exynos4210_i2c.c Include migration/vmstate.h less 2019-08-16 13:31:52 +02:00
imx_i2c.c Include migration/vmstate.h less 2019-08-16 13:31:52 +02:00
Kconfig hw/arm: Express dependencies of realview, versatile and vexpress with Kconfig 2019-05-13 09:36:31 +02:00
Makefile.objs hw/*/Makefile.objs: Move many .o files to common-objs 2020-02-04 09:00:57 +01:00
microbit_i2c.c Include migration/vmstate.h less 2019-08-16 13:31:52 +02:00
mpc_i2c.c Include migration/vmstate.h less 2019-08-16 13:31:52 +02:00
omap_i2c.c qdev: set properties with device_class_set_props() 2020-01-24 20:59:15 +01:00
pm_smbus.c Include hw/hw.h exactly where needed 2019-08-16 13:31:52 +02:00
ppc4xx_i2c.c hw/*/Makefile.objs: Move many .o files to common-objs 2020-02-04 09:00:57 +01:00
smbus_eeprom.c smbus: Fix spd_data_generate() error API violation 2020-04-29 08:01:52 +02:00
smbus_ich9.c hw/i2c/smbus_ich9: Include "qemu/range.h" 2020-03-09 15:59:31 +01:00
smbus_master.c Include hw/hw.h exactly where needed 2019-08-16 13:31:52 +02:00
smbus_slave.c Include hw/hw.h exactly where needed 2019-08-16 13:31:52 +02:00
trace-events aspeed/i2c: Add trace events 2019-12-16 10:46:34 +00:00
versatile_i2c.c hw/i2c/bitbang_i2c: Use in-place rather than malloc'd bitbang_i2c_interface struct 2019-07-03 10:51:35 +02:00