From 422ebb322b9a1c59fb91e0a759ccb2b0e473e3c5 Mon Sep 17 00:00:00 2001 From: OBattler Date: Sun, 21 Jul 2024 15:13:16 +0200 Subject: [PATCH] Migrate device configuration regardless of what instance it is. --- src/device.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/device.c b/src/device.c index cf0764946..41f4b74d5 100644 --- a/src/device.c +++ b/src/device.c @@ -97,14 +97,12 @@ device_set_context(device_context_t *c, const device_t *dev, int inst) if (inst) { sprintf(c->name, "%s #%i", dev->name, inst); - /* If this is the first instance and a numbered section is not present, but a non-numbered - section of the same name is, rename the non-numbered section to numbered. */ - if (inst == 1) { - const void *sec = config_find_section(c->name); - void * single_sec = config_find_section((char *) dev->name); - if ((sec == NULL) && (single_sec != NULL)) - config_rename_section(single_sec, c->name); - } + /* If a numbered section is not present, but a non-numbered of the same name + is, rename the non-numbered section to numbered. */ + const void *sec = config_find_section(c->name); + void * single_sec = config_find_section((char *) dev->name); + if ((sec == NULL) && (single_sec != NULL)) + config_rename_section(single_sec, c->name); } else sprintf(c->name, "%s", dev->name); }