summaryrefslogtreecommitdiff
path: root/drivers/core
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2023-09-19 20:05:48 -0600
committerSimon Glass <sjg@chromium.org>2023-10-04 09:25:20 -0600
commita535a371a9d06b3cfa696c8a67f15a621be3ec52 (patch)
tree1a58ff21ba7f9dca37200a1a27558ba08942f410 /drivers/core
parent65b9b3462bec2966911658836983819ab4e4823e (diff)
downloadu-boot-a535a371a9d06b3cfa696c8a67f15a621be3ec52.tar.gz
u-boot-a535a371a9d06b3cfa696c8a67f15a621be3ec52.tar.bz2
u-boot-a535a371a9d06b3cfa696c8a67f15a621be3ec52.zip
dm: core: Adjust dump-sorting to get stats only when needed
If we are not sorting the tree we don't need to get the stats. Adjust the code to avoid the wasted time. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'drivers/core')
-rw-r--r--drivers/core/dump.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/core/dump.c b/drivers/core/dump.c
index 4023b390f5..841124830e 100644
--- a/drivers/core/dump.c
+++ b/drivers/core/dump.c
@@ -90,9 +90,8 @@ static void dm_dump_tree_single(struct udevice *dev, bool sort)
int dev_count, uclasses;
struct udevice **devs = NULL;
- dm_get_stats(&dev_count, &uclasses);
-
if (sort) {
+ dm_get_stats(&dev_count, &uclasses);
devs = calloc(dev_count, sizeof(struct udevice *));
if (!devs) {
printf("(out of memory)\n");