Skip to content

Commit 7cd1c98

Browse files
author
Markus Armbruster
committed
arm/{bcm2835,fsl-imx25,fsl-imx6}: Fix realize error API violations
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. bcm2835_peripherals_realize(), fsl_imx25_realize() and fsl_imx6_realize() are wrong that way: they pass &err to object_property_set_uint() and object_property_set_bool() without checking it, and then to sysbus_realize(). Harmless, because the former can't actually fail here. Fix by passing &error_abort instead. Cc: Peter Maydell <[email protected]> Cc: Andrew Baumann <[email protected]> Cc: "Philippe Mathieu-Daudé" <[email protected]> Cc: Jean-Christophe Dubois <[email protected]> Cc: [email protected] Signed-off-by: Markus Armbruster <[email protected]> Message-Id: <[email protected]> Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
1 parent 17d5d49 commit 7cd1c98

File tree

3 files changed

+14
-22
lines changed

3 files changed

+14
-22
lines changed

hw/arm/bcm2835_peripherals.c

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -283,16 +283,12 @@ static void bcm2835_peripherals_realize(DeviceState *dev, Error **errp)
283283
* For the exact details please refer to the Arasan documentation:
284284
* SD3.0_Host_AHB_eMMC4.4_Usersguide_ver5.9_jan11_10.pdf
285285
*/
286-
object_property_set_uint(OBJECT(&s->sdhci), 3, "sd-spec-version", &err);
286+
object_property_set_uint(OBJECT(&s->sdhci), 3, "sd-spec-version",
287+
&error_abort);
287288
object_property_set_uint(OBJECT(&s->sdhci), BCM2835_SDHC_CAPAREG, "capareg",
288-
&err);
289+
&error_abort);
289290
object_property_set_bool(OBJECT(&s->sdhci), true, "pending-insert-quirk",
290-
&err);
291-
if (err) {
292-
error_propagate(errp, err);
293-
return;
294-
}
295-
291+
&error_abort);
296292
sysbus_realize(SYS_BUS_DEVICE(&s->sdhci), &err);
297293
if (err) {
298294
error_propagate(errp, err);

hw/arm/fsl-imx25.c

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -260,15 +260,13 @@ static void fsl_imx25_realize(DeviceState *dev, Error **errp)
260260
};
261261

262262
object_property_set_uint(OBJECT(&s->esdhc[i]), 2, "sd-spec-version",
263-
&err);
263+
&error_abort);
264264
object_property_set_uint(OBJECT(&s->esdhc[i]), IMX25_ESDHC_CAPABILITIES,
265-
"capareg", &err);
265+
"capareg",
266+
&error_abort);
266267
object_property_set_uint(OBJECT(&s->esdhc[i]), SDHCI_VENDOR_IMX,
267-
"vendor", &err);
268-
if (err) {
269-
error_propagate(errp, err);
270-
return;
271-
}
268+
"vendor",
269+
&error_abort);
272270
sysbus_realize(SYS_BUS_DEVICE(&s->esdhc[i]), &err);
273271
if (err) {
274272
error_propagate(errp, err);

hw/arm/fsl-imx6.c

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -336,15 +336,13 @@ static void fsl_imx6_realize(DeviceState *dev, Error **errp)
336336

337337
/* UHS-I SDIO3.0 SDR104 1.8V ADMA */
338338
object_property_set_uint(OBJECT(&s->esdhc[i]), 3, "sd-spec-version",
339-
&err);
339+
&error_abort);
340340
object_property_set_uint(OBJECT(&s->esdhc[i]), IMX6_ESDHC_CAPABILITIES,
341-
"capareg", &err);
341+
"capareg",
342+
&error_abort);
342343
object_property_set_uint(OBJECT(&s->esdhc[i]), SDHCI_VENDOR_IMX,
343-
"vendor", &err);
344-
if (err) {
345-
error_propagate(errp, err);
346-
return;
347-
}
344+
"vendor",
345+
&error_abort);
348346
sysbus_realize(SYS_BUS_DEVICE(&s->esdhc[i]), &err);
349347
if (err) {
350348
error_propagate(errp, err);

0 commit comments

Comments
 (0)