From: Simon Glass Date: Fri, 14 May 2021 01:39:24 +0000 (-0600) Subject: dm: core: Check uclass_get() return value when dumping X-Git-Url: http://git.dujemihanovic.xyz/img/sics.gif?a=commitdiff_plain;h=9dec2c1f03922977725d14ebc89fdc05b1f32511;p=u-boot.git dm: core: Check uclass_get() return value when dumping Update dm_dump_drivers() to use the return value from uclass_get() to check the validity of uc. This is equivalent and should be more attractive to Coverity. Signed-off-by: Simon Glass Reported-by: Coverity (CID: 316601) --- diff --git a/drivers/core/dump.c b/drivers/core/dump.c index f8afea30a9..f2f9cacc56 100644 --- a/drivers/core/dump.c +++ b/drivers/core/dump.c @@ -130,18 +130,19 @@ void dm_dump_drivers(void) struct driver *entry; struct udevice *udev; struct uclass *uc; + int ret; int i; puts("Driver uid uclass Devices\n"); puts("----------------------------------------------------------\n"); for (entry = d; entry < d + n_ents; entry++) { - uclass_get(entry->id, &uc); + ret = uclass_get(entry->id, &uc); printf("%-25.25s %-3.3d %-20.20s ", entry->name, entry->id, - uc ? uc->uc_drv->name : ""); + !ret ? uc->uc_drv->name : ""); - if (!uc) { + if (ret) { puts("\n"); continue; }