thunderbolt: Assert that a service driver has a probe callback

tb_service_probe() calls the driver's probe function unconditionally.
Check at driver register time that this callback is valid to prevent a
NULL pointer exception.

Signed-off-by: Uwe Kleine-König (The Capable Hub) <u.kleine-koenig@baylibre.com>
Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
This commit is contained in:
Uwe Kleine-König (The Capable Hub) 2026-06-18 12:14:51 +02:00 committed by Mika Westerberg
parent 45f104755a
commit 36eea3468c

View File

@ -968,6 +968,9 @@ tb_xdp_schedule_request(struct tb *tb, const struct tb_xdp_header *hdr,
*/
int tb_register_service_driver(struct tb_service_driver *drv)
{
if (!drv->probe)
return -EINVAL;
drv->driver.bus = &tb_bus_type;
return driver_register(&drv->driver);
}