Message ID | 20210514014011.2832707-6-sjg@chromium.org |
---|---|
State | Accepted |
Commit | 9dec2c1f03922977725d14ebc89fdc05b1f32511 |
Delegated to: | Tom Rini |
Headers | show |
Series | [v2,01/16] sandbox: net: Ensure host name is always a valid string | expand |
On Thu, May 13, 2021 at 07:39:24PM -0600, Simon Glass wrote: > 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 <sjg@chromium.org> > Reported-by: Coverity (CID: 316601) Applied to u-boot/master, thanks!
diff --git a/drivers/core/dump.c b/drivers/core/dump.c index f8afea30a93..f2f9cacc56c 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 : "<no uclass>"); + !ret ? uc->uc_drv->name : "<no uclass>"); - if (!uc) { + if (ret) { puts("\n"); continue; }
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 <sjg@chromium.org> Reported-by: Coverity (CID: 316601) --- (no changes since v1) drivers/core/dump.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)