aboutsummaryrefslogtreecommitdiff
path: root/include/hw/i2c
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2020-04-22 15:48:13 +0200
committerMarkus Armbruster <armbru@redhat.com>2020-04-29 08:01:52 +0200
commitf26740c61a57f1a1556f79a49c6863479fe5aa6b (patch)
tree870af0c6b38bda6e7f32e9774fef9b0755c1ec86 /include/hw/i2c
parentfc0cfc1decb5457058d7cbfeb7ae26ad5d6ecba4 (diff)
downloadqemu-f26740c61a57f1a1556f79a49c6863479fe5aa6b.zip
qemu-f26740c61a57f1a1556f79a49c6863479fe5aa6b.tar.gz
qemu-f26740c61a57f1a1556f79a49c6863479fe5aa6b.tar.bz2
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>
Diffstat (limited to 'include/hw/i2c')
-rw-r--r--include/hw/i2c/smbus_eeprom.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/include/hw/i2c/smbus_eeprom.h b/include/hw/i2c/smbus_eeprom.h
index 15e2151..68b0063 100644
--- a/include/hw/i2c/smbus_eeprom.h
+++ b/include/hw/i2c/smbus_eeprom.h
@@ -31,6 +31,6 @@ void smbus_eeprom_init(I2CBus *bus, int nb_eeprom,
const uint8_t *eeprom_spd, int size);
enum sdram_type { SDR = 0x4, DDR = 0x7, DDR2 = 0x8 };
-uint8_t *spd_data_generate(enum sdram_type type, ram_addr_t size, Error **errp);
+uint8_t *spd_data_generate(enum sdram_type type, ram_addr_t size);
#endif