Skip to content

Commit 05be3d3

Browse files
committed
[ot] hw/opentitan: all: remove default ot_id string creation.
The parent should specify this property. Signed-off-by: Emmanuel Blot <eblot@rivosinc.com> (cherry picked from commit 851989e)
1 parent de016d8 commit 05be3d3

File tree

5 files changed

+7
-24
lines changed

5 files changed

+7
-24
lines changed

hw/opentitan/ot_gpio_eg.c

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -147,9 +147,6 @@ struct OtGpioEgClass {
147147
ResettablePhases parent_phases;
148148
};
149149

150-
151-
static const char DEFAULT_OT_ID[] = "";
152-
153150
static void ot_gpio_eg_update_backend(OtGpioEgState *s, bool force);
154151

155152
static void ot_gpio_eg_update_irqs(OtGpioEgState *s)
@@ -711,10 +708,6 @@ static void ot_gpio_eg_reset_enter(Object *obj, ResetType type)
711708
OtGpioEgClass *c = OT_GPIO_EG_GET_CLASS(obj);
712709
OtGpioEgState *s = OT_GPIO_EG(obj);
713710

714-
if (!s->ot_id) {
715-
s->ot_id = g_strdup(DEFAULT_OT_ID);
716-
}
717-
718711
trace_ot_gpio_reset(s->ot_id, "> enter");
719712
if (c->parent_phases.enter) {
720713
c->parent_phases.enter(obj, type);
@@ -777,6 +770,8 @@ static void ot_gpio_eg_realize(DeviceState *dev, Error **errp)
777770
OtGpioEgState *s = OT_GPIO_EG(dev);
778771
(void)errp;
779772

773+
g_assert(s->ot_id);
774+
780775
qemu_chr_fe_set_handlers(&s->chr, &ot_gpio_eg_chr_can_receive,
781776
&ot_gpio_eg_chr_receive,
782777
&ot_gpio_eg_chr_event_hander,

hw/opentitan/ot_otp_dj.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3933,13 +3933,10 @@ static void ot_otp_dj_reset_exit(Object *obj, ResetType type)
39333933

39343934
static void ot_otp_dj_realize(DeviceState *dev, Error **errp)
39353935
{
3936-
(void)errp;
39373936
OtOTPDjState *s = OT_OTP_DJ(dev);
3937+
(void)errp;
39383938

3939-
if (!s->ot_id) {
3940-
s->ot_id =
3941-
g_strdup(object_get_canonical_path_component(OBJECT(s)->parent));
3942-
}
3939+
g_assert(s->ot_id);
39433940

39443941
ot_otp_dj_configure_scrmbl_key(s);
39453942
ot_otp_dj_configure_digest(s);

hw/opentitan/ot_rstmgr.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -573,10 +573,7 @@ static void ot_rstmgr_realize(DeviceState *dev, Error **errp)
573573
OtRstMgrState *s = OT_RSTMGR(dev);
574574
(void)errp;
575575

576-
if (!s->ot_id) {
577-
s->ot_id =
578-
g_strdup(object_get_canonical_path_component(OBJECT(s)->parent));
579-
}
576+
g_assert(s->ot_id);
580577
}
581578

582579
static void ot_rstmgr_init(Object *obj)

hw/opentitan/ot_spi_host.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1321,11 +1321,8 @@ static void ot_spi_host_realize(DeviceState *dev, Error **errp)
13211321
OtSPIHostState *s = OT_SPI_HOST(dev);
13221322
(void)errp;
13231323

1324+
g_assert(s->ot_id);
13241325
g_assert(s->pclk);
1325-
if (!s->ot_id) {
1326-
s->ot_id =
1327-
g_strdup(object_get_canonical_path_component(OBJECT(s)->parent));
1328-
}
13291326

13301327
s->cs_lines = g_new0(qemu_irq, (size_t)s->num_cs);
13311328

hw/opentitan/ot_unimp.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -258,10 +258,7 @@ static void ot_unimp_realize(DeviceState *dev, Error **errp)
258258
{
259259
OtUnimpState *s = OT_UNIMP(dev);
260260

261-
if (!s->ot_id) {
262-
error_setg(errp, "ot_id property required for " TYPE_OT_UNIMP);
263-
return;
264-
}
261+
g_assert(s->ot_id);
265262

266263
if (!s->size || (s->size & 3u)) {
267264
error_setg(errp, "%s: invalid size", s->ot_id);

0 commit comments

Comments
 (0)