Skip to content

Commit 756f739

Browse files
philmdpm215
authored andcommitted
hw/arm/aspeed: Do not create and attach empty SD cards by default
Since added in commit 2bea128, 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: 2bea128 ("hw/sd/aspeed_sdhci: New device") Signed-off-by: Philippe Mathieu-Daudé <[email protected]> Message-id: [email protected] Reviewed-by: Cédric Le Goater <[email protected]> Signed-off-by: Peter Maydell <[email protected]>
1 parent ad938fc commit 756f739

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

hw/arm/aspeed.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -246,11 +246,12 @@ static void sdhci_attach_drive(SDHCIState *sdhci, DriveInfo *dinfo)
246246
{
247247
DeviceState *card;
248248

249-
card = qdev_new(TYPE_SD_CARD);
250-
if (dinfo) {
251-
qdev_prop_set_drive_err(card, "drive", blk_by_legacy_dinfo(dinfo),
252-
&error_fatal);
249+
if (!dinfo) {
250+
return;
253251
}
252+
card = qdev_new(TYPE_SD_CARD);
253+
qdev_prop_set_drive_err(card, "drive", blk_by_legacy_dinfo(dinfo),
254+
&error_fatal);
254255
qdev_realize_and_unref(card,
255256
qdev_get_child_bus(DEVICE(sdhci), "sd-bus"),
256257
&error_fatal);

0 commit comments

Comments
 (0)