On 00:19 Fri 29 Aug , Philippe Mathieu-Daudé wrote: > Caution: This message originated from an External Source. Use proper caution > when opening attachments, clicking links, or responding. > > > On 22/8/25 17:15, Luc Michel wrote: > > Refactor the SDHCI controllers creation using the VersalMap structure. > > > > Signed-off-by: Luc Michel <luc.mic...@amd.com> > > Reviewed-by: Francisco Iglesias <francisco.igles...@amd.com> > > --- > > include/hw/arm/xlnx-versal.h | 5 +- > > hw/arm/xlnx-versal-virt.c | 43 ++-------------- > > hw/arm/xlnx-versal.c | 96 ++++++++++++++++++++++++++++-------- > > 3 files changed, 83 insertions(+), 61 deletions(-) > > Reviewed-by: Philippe Mathieu-Daudé <phi...@linaro.org> > > > +void versal_sdhci_plug_card(Versal *s, int sd_idx, BlockBackend *blk) > > +{ > > + DeviceState *sdhci, *card; > > + > > + sdhci = DEVICE(versal_get_child_idx(s, "sdhci", sd_idx)); > > + > > + if (sdhci == NULL) { > > Can that happen?
If sd_idx is out-of-range. It should not if the SoC user correctly use the interface (querying the number of SDHCI controllers using versal_get_num_sdhci()). I agree I could have put a g_assert() or report an error. Luc > > > + return; > > + } > > + > > + card = qdev_new(TYPE_SD_CARD); > > + object_property_add_child(OBJECT(sdhci), "card[*]", OBJECT(card)); > > + qdev_prop_set_drive_err(card, "drive", blk, &error_fatal); > > + qdev_realize_and_unref(card, qdev_get_child_bus(DEVICE(sdhci), > > "sd-bus"), > > + &error_fatal); > > +} > --