]> Git Repo - qemu.git/commitdiff
hw/arm/aspeed: Do not create and attach empty SD cards by default
authorPhilippe Mathieu-Daudé <[email protected]>
Mon, 13 Jul 2020 13:36:12 +0000 (14:36 +0100)
committerPeter Maydell <[email protected]>
Mon, 13 Jul 2020 13:36:12 +0000 (14:36 +0100)
Since added in commit 2bea128c3d, each SDHCI is wired with a SD
card, using empty card when no block drive provided. This is not
the desired behavior. The SDHCI exposes a SD bus to plug cards
on, if no card available, it is fine to have an unplugged bus.

Avoid creating unnecessary SD card device when no block drive
provided.

Fixes: 2bea128c3d ("hw/sd/aspeed_sdhci: New device")
Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
Message-id: 20200705173402[email protected]
Reviewed-by: Cédric Le Goater <[email protected]>
Signed-off-by: Peter Maydell <[email protected]>
hw/arm/aspeed.c

index 660dcb5414438f12828233b2fb90301bf3d00752..6a3a345a6f609639d894debbb8bb132e2eba3bb3 100644 (file)
@@ -246,11 +246,12 @@ static void sdhci_attach_drive(SDHCIState *sdhci, DriveInfo *dinfo)
 {
         DeviceState *card;
 
-        card = qdev_new(TYPE_SD_CARD);
-        if (dinfo) {
-            qdev_prop_set_drive_err(card, "drive", blk_by_legacy_dinfo(dinfo),
-                                    &error_fatal);
+        if (!dinfo) {
+            return;
         }
+        card = qdev_new(TYPE_SD_CARD);
+        qdev_prop_set_drive_err(card, "drive", blk_by_legacy_dinfo(dinfo),
+                                &error_fatal);
         qdev_realize_and_unref(card,
                                qdev_get_child_bus(DEVICE(sdhci), "sd-bus"),
                                &error_fatal);
This page took 0.028998 seconds and 4 git commands to generate.