From patchwork Wed Apr 29 02:17:15 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peng Fan X-Patchwork-Id: 238780 List-Id: U-Boot discussion From: peng.fan at nxp.com (Peng Fan) Date: Wed, 29 Apr 2020 10:17:15 +0800 Subject: [PATCH 2/7] common: board_f: Use cpu_get_current_dev in print_cpuinfo In-Reply-To: <20200429021720.6653-1-peng.fan@nxp.com> References: <20200429021720.6653-1-peng.fan@nxp.com> Message-ID: <20200429021720.6653-2-peng.fan@nxp.com> From: Ye Li Current print_cpuinfo gets the first udevice in CPU class to return the cpu info. This has problem if the boot CPU is not fixed. Changing to use new API cpu_get_current_dev to fix the issue. Signed-off-by: Ye Li Signed-off-by: Peng Fan Reviewed-by: Simon Glass --- common/board_f.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/common/board_f.c b/common/board_f.c index 5c650f046c..5223453511 100644 --- a/common/board_f.c +++ b/common/board_f.c @@ -183,11 +183,11 @@ static int print_cpuinfo(void) char desc[512]; int ret; - ret = uclass_first_device_err(UCLASS_CPU, &dev); - if (ret) { - debug("%s: Could not get CPU device (err = %d)\n", - __func__, ret); - return ret; + dev = cpu_get_current_dev(); + if (!dev) { + debug("%s: Could not get CPU device\n", + __func__); + return -ENODEV; } ret = cpu_get_desc(dev, desc, sizeof(desc));