On Tue, 16 Jun 2026 at 11:22, Peter Maydell <[email protected]> wrote:
>
> On Tue, 2 Jun 2026 at 07:34, Kuan-Jui Chiu <[email protected]> wrote:
> >
> > This patch add a new model for Axiado SD host controller which is compatible
> > with SDHCI 3.0 spec
> >
> > This device model also includes a eMMC PHY which helps to control SD/eMMC
> >
> > Signed-off-by: Kuan-Jui Chiu <[email protected]>
>
> > +static void axiado_sdhci_realize(DeviceState *dev, Error **errp)
> > +{
> > +    AxiadoSDHCIState *s = AXIADO_SDHCI(dev);
> > +    SysBusDevice *sbd = SYS_BUS_DEVICE(dev);
> > +    SysBusDevice *sdhci_sbd;
> > +
> > +    qdev_prop_set_uint64(DEVICE(&s->sdhci), "capareg", 0x216737eed0b0);
> > +    qdev_prop_set_uint64(DEVICE(&s->sdhci), "sd-spec-version", 3);
> > +
> > +    sdhci_sbd = SYS_BUS_DEVICE(&s->sdhci);
> > +    sysbus_realize(sdhci_sbd, errp);
> > +    if (*errp) {
> > +        return;
> > +    }
>
> You need an "ERRP_GUARD();" line at the top of this function,
> because otherwise errp can be NULL here. (There's a long comment
> in include/qapi/error.h that discusses the various ways of
> handling Error objects and the standard patterns to use.)

Actually, better would be to use the return value of sysbus_realize()
instead of looking at errp:

    if (!sysbus_realize(sdhci_sbd, errp)) {
        return;
    }

Then you don't need the ERRP_GUARD.

-- PMM

Reply via email to