pci: Avoid a crash in device_is_on_pci_bus()
authorSimon Glass <sjg@chromium.org>
Tue, 7 Jul 2020 19:12:10 +0000 (13:12 -0600)
committerBin Meng <bmeng.cn@gmail.com>
Fri, 17 Jul 2020 06:32:24 +0000 (14:32 +0800)
commit20349781a3ca833c67126888ddfce7c1517c772e
treeeb84642875edd981bf865836d8f69ca61e4ede42
parent58a6ccd34e79acb7835699eab9c1ecb6cc8bbd47
pci: Avoid a crash in device_is_on_pci_bus()

This function cannot currently be called on the root node. Add a check
for this as well as a test.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Wolfgang Wallner <wolfgang.wallner@br-automation.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
include/dm/device.h
test/dm/pci.c