summaryrefslogtreecommitdiffstats
path: root/drivers/bus/fsl-mc
diff options
context:
space:
mode:
authorIoana Ciornei <ioana.ciornei@nxp.com>2021-01-08 11:07:24 +0200
committerJakub Kicinski <kuba@kernel.org>2021-01-09 16:21:30 -0800
commitef57e6c9f7d988c550111d73fe337211da3d5100 (patch)
tree1ef59be8afef5d3bd5306d1c425da7353954507c /drivers/bus/fsl-mc
parentd87e606373f641c58d5e8e4c48b3216fd9d1c78a (diff)
downloadlinux-ef57e6c9f7d988c550111d73fe337211da3d5100.tar.bz2
bus: fsl-mc: return -EPROBE_DEFER when a device is not yet discovered
The fsl_mc_get_endpoint() should return a pointer to the connected fsl_mc device, if there is one. By interrogating the MC firmware, we know if there is an endpoint or not so when the endpoint device is actually searched on the fsl-mc bus and not found we are hitting the case in which the device has not been yet discovered by the bus. Return -EPROBE_DEFER so that callers can differentiate this case. Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com> Acked-by: Laurentiu Tudor <laurentiu.tudor@nxp.com> Reviewed-by: Andrew Lunn <andrew@lunn.ch> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'drivers/bus/fsl-mc')
-rw-r--r--drivers/bus/fsl-mc/fsl-mc-bus.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/bus/fsl-mc/fsl-mc-bus.c b/drivers/bus/fsl-mc/fsl-mc-bus.c
index b8e6acdf932e..8af978bd0000 100644
--- a/drivers/bus/fsl-mc/fsl-mc-bus.c
+++ b/drivers/bus/fsl-mc/fsl-mc-bus.c
@@ -840,6 +840,15 @@ struct fsl_mc_device *fsl_mc_get_endpoint(struct fsl_mc_device *mc_dev)
endpoint_desc.id = endpoint2.id;
endpoint = fsl_mc_device_lookup(&endpoint_desc, mc_bus_dev);
+ /*
+ * We know that the device has an endpoint because we verified by
+ * interrogating the firmware. This is the case when the device was not
+ * yet discovered by the fsl-mc bus, thus the lookup returned NULL.
+ * Differentiate this case by returning EPROBE_DEFER.
+ */
+ if (!endpoint)
+ return ERR_PTR(-EPROBE_DEFER);
+
return endpoint;
}
EXPORT_SYMBOL_GPL(fsl_mc_get_endpoint);