mirror of
https://github.com/Fishwaldo/u-boot.git
synced 2025-03-21 14:41:31 +00:00
test: bus: Add a check that dev is not NULL
We know that uclass_get_device() and device_find_child_by_of_offset() do
not return NULL for dev when they succeeds but coverity does not. Add an
extra check to hopefully keep it happy.
Signed-off-by: Simon Glass <sjg@chromium.org>
Reported-by: Coverity (CID: 163246)
Fixes: 0753bc2
(dm: Simple Watchdog uclass)
This commit is contained in:
parent
9eace7f59e
commit
4f414d392f
1 changed files with 3 additions and 0 deletions
|
@ -171,13 +171,16 @@ static int dm_test_bus_children_of_offset(struct unit_test_state *uts)
|
|||
int node;
|
||||
|
||||
ut_assertok(uclass_get_device(UCLASS_TEST_BUS, 0, &bus));
|
||||
ut_assertnonnull(bus);
|
||||
|
||||
/* Find a valid child */
|
||||
node = fdt_path_offset(blob, "/some-bus/c-test@1");
|
||||
ut_assert(node > 0);
|
||||
ut_assertok(device_find_child_by_of_offset(bus, node, &dev));
|
||||
ut_assertnonnull(dev);
|
||||
ut_assert(!(dev->flags & DM_FLAG_ACTIVATED));
|
||||
ut_assertok(device_get_child_by_of_offset(bus, node, &dev));
|
||||
ut_assertnonnull(dev);
|
||||
ut_assert(dev->flags & DM_FLAG_ACTIVATED);
|
||||
|
||||
return 0;
|
||||
|
|
Loading…
Add table
Reference in a new issue