* [PATCH v2] coreboot_table: skip failing entries instead of aborting populate
@ 2026-04-30 20:23 Titouan Ameline de Cadeville
2026-04-30 20:45 ` Julius Werner
2026-04-30 21:07 ` Brian Norris
0 siblings, 2 replies; 3+ messages in thread
From: Titouan Ameline de Cadeville @ 2026-04-30 20:23 UTC (permalink / raw)
To: jwerner
Cc: tzungbi, briannorris, chrome-platform, linux-kernel,
Titouan Ameline de Cadeville
coreboot_table_populate() registers devices one by one. If
device_register() fails for one entry, the current code returns
immediately, leaving previously registered devices orphaned on the
coreboot bus with no cleanup path.
Since coreboot table entries are independent of each other, a failure
on one entry should not prevent the others from being registered.
This mirrors the strategy used by of_platform_populate(), which skips
individual failures rather than aborting.
Log a warning and continue the loop on device_register() failure.
Signed-off-by: Titouan Ameline de Cadeville <titouan.ameline@gmail.com>
---
v2: continue the loop on failure instead of unregistering all devices
(suggested by Julius Werner, with reference to of_platform_populate()
from Brian Norris)
drivers/firmware/google/coreboot_table.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/firmware/google/coreboot_table.c b/drivers/firmware/google/coreboot_table.c
index c769631ea15d..82be21434be4 100644
--- a/drivers/firmware/google/coreboot_table.c
+++ b/drivers/firmware/google/coreboot_table.c
@@ -150,8 +150,9 @@ static int coreboot_table_populate(struct device *dev, void *ptr)
ret = device_register(&device->dev);
if (ret) {
+ dev_warn(dev, "failed to register coreboot device: %d\n", ret);
put_device(&device->dev);
- return ret;
+ continue;
}
ptr_entry += entry->size;
--
2.44.2
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH v2] coreboot_table: skip failing entries instead of aborting populate
2026-04-30 20:23 [PATCH v2] coreboot_table: skip failing entries instead of aborting populate Titouan Ameline de Cadeville
@ 2026-04-30 20:45 ` Julius Werner
2026-04-30 21:07 ` Brian Norris
1 sibling, 0 replies; 3+ messages in thread
From: Julius Werner @ 2026-04-30 20:45 UTC (permalink / raw)
To: Titouan Ameline de Cadeville
Cc: jwerner, tzungbi, briannorris, chrome-platform, linux-kernel
> coreboot_table_populate() registers devices one by one. If
> device_register() fails for one entry, the current code returns
> immediately, leaving previously registered devices orphaned on the
> coreboot bus with no cleanup path.
>
> Since coreboot table entries are independent of each other, a failure
> on one entry should not prevent the others from being registered.
> This mirrors the strategy used by of_platform_populate(), which skips
> individual failures rather than aborting.
>
> Log a warning and continue the loop on device_register() failure.
>
> Signed-off-by: Titouan Ameline de Cadeville <titouan.ameline@gmail.com>
Reviewed-by: Julius Werner <jwerner@chromium.org>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] coreboot_table: skip failing entries instead of aborting populate
2026-04-30 20:23 [PATCH v2] coreboot_table: skip failing entries instead of aborting populate Titouan Ameline de Cadeville
2026-04-30 20:45 ` Julius Werner
@ 2026-04-30 21:07 ` Brian Norris
1 sibling, 0 replies; 3+ messages in thread
From: Brian Norris @ 2026-04-30 21:07 UTC (permalink / raw)
To: Titouan Ameline de Cadeville
Cc: jwerner, tzungbi, chrome-platform, linux-kernel
On Thu, Apr 30, 2026 at 10:23:05PM +0200, Titouan Ameline de Cadeville wrote:
> coreboot_table_populate() registers devices one by one. If
> device_register() fails for one entry, the current code returns
> immediately, leaving previously registered devices orphaned on the
> coreboot bus with no cleanup path.
>
> Since coreboot table entries are independent of each other, a failure
> on one entry should not prevent the others from being registered.
> This mirrors the strategy used by of_platform_populate(), which skips
> individual failures rather than aborting.
>
> Log a warning and continue the loop on device_register() failure.
>
> Signed-off-by: Titouan Ameline de Cadeville <titouan.ameline@gmail.com>
> ---
> v2: continue the loop on failure instead of unregistering all devices
> (suggested by Julius Werner, with reference to of_platform_populate()
> from Brian Norris)
>
> drivers/firmware/google/coreboot_table.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/firmware/google/coreboot_table.c b/drivers/firmware/google/coreboot_table.c
> index c769631ea15d..82be21434be4 100644
> --- a/drivers/firmware/google/coreboot_table.c
> +++ b/drivers/firmware/google/coreboot_table.c
> @@ -150,8 +150,9 @@ static int coreboot_table_populate(struct device *dev, void *ptr)
>
> ret = device_register(&device->dev);
> if (ret) {
> + dev_warn(dev, "failed to register coreboot device: %d\n", ret);
> put_device(&device->dev);
> - return ret;
> + continue;
> }
>
> ptr_entry += entry->size;
Isn't it important to still increment ptr_entry on failure/continue?
Otherwise, you may re-populate a new device with the same contents, and
you may not actually register all devices. (You'll be off-by-1, at
least.)
To fix this, you could either drop the 'continue' (let it fall through)
or else move this line up.
Brian
> --
> 2.44.2
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-04-30 21:07 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-30 20:23 [PATCH v2] coreboot_table: skip failing entries instead of aborting populate Titouan Ameline de Cadeville
2026-04-30 20:45 ` Julius Werner
2026-04-30 21:07 ` Brian Norris
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox