dm: pci: Adjust pci_find_and_bind_driver() to return -EPERM
authorSimon Glass <sjg@chromium.org>
Tue, 8 Sep 2015 23:52:49 +0000 (17:52 -0600)
committerSimon Glass <sjg@chromium.org>
Wed, 21 Oct 2015 13:46:25 +0000 (07:46 -0600)
commit5dbcf3a0f91b1d7612ede730736efe696edf4d85
tree345b5ff6ec0ea15f0b4c914f8d2cbf3d0adff5a4
parent3129ace48948043467439e848264a287d9cd5cce
dm: pci: Adjust pci_find_and_bind_driver() to return -EPERM

The current code returns 0 even if it failed to find or bind a driver. The
caller then has to check the returned device to see if it is NULL. It is
better to return an error code in this case so that it is clear what
happened.

Adjust the code to return -EPERM, indicating that the device was not bound
because it is not needed for pre-relocation use. Add comments so that the
return value is clear.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
drivers/pci/pci-uclass.c