Skip to content

Commit ef57e6c

Browse files
IoanaCiorneikuba-moo
authored andcommitted
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 <[email protected]> Acked-by: Laurentiu Tudor <[email protected]> Reviewed-by: Andrew Lunn <[email protected]> Signed-off-by: Jakub Kicinski <[email protected]>
1 parent d87e606 commit ef57e6c

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

drivers/bus/fsl-mc/fsl-mc-bus.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -840,6 +840,15 @@ struct fsl_mc_device *fsl_mc_get_endpoint(struct fsl_mc_device *mc_dev)
840840
endpoint_desc.id = endpoint2.id;
841841
endpoint = fsl_mc_device_lookup(&endpoint_desc, mc_bus_dev);
842842

843+
/*
844+
* We know that the device has an endpoint because we verified by
845+
* interrogating the firmware. This is the case when the device was not
846+
* yet discovered by the fsl-mc bus, thus the lookup returned NULL.
847+
* Differentiate this case by returning EPROBE_DEFER.
848+
*/
849+
if (!endpoint)
850+
return ERR_PTR(-EPROBE_DEFER);
851+
843852
return endpoint;
844853
}
845854
EXPORT_SYMBOL_GPL(fsl_mc_get_endpoint);

0 commit comments

Comments
 (0)