aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSudeep Holla <[email protected]>2021-06-24 10:50:59 +0100
committerSudeep Holla <[email protected]>2021-07-12 14:16:19 +0100
commit5e469dac326555d2038d199a6329458cc82a34e5 (patch)
treef499fb27ac4aba1e03f9c3255a762ceda47aeacd
parent38e0c99249f8f12e1450234a0f7fb357a1b73843 (diff)
firmware: arm_scmi: Ensure drivers provide a probe function
The bus probe callback calls the driver callback without further checking. Better be safe than sorry and refuse registration of a driver without a probe function to prevent a NULL pointer exception. Link: https://lore.kernel.org/r/[email protected] Fixes: 933c504424a2 ("firmware: arm_scmi: add scmi protocol bus to enumerate protocol devices") Reported-by: Uwe Kleine-König <[email protected]> Tested-by: Cristian Marussi <[email protected]> Reviewed-by: Cristian Marussi <[email protected]> Acked-by: Uwe Kleine-König <[email protected]> Signed-off-by: Sudeep Holla <[email protected]>
-rw-r--r--drivers/firmware/arm_scmi/bus.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/firmware/arm_scmi/bus.c b/drivers/firmware/arm_scmi/bus.c
index dc113ad37ad9..6c7e24935eca 100644
--- a/drivers/firmware/arm_scmi/bus.c
+++ b/drivers/firmware/arm_scmi/bus.c
@@ -134,6 +134,9 @@ int scmi_driver_register(struct scmi_driver *driver, struct module *owner,
{
int retval;
+ if (!driver->probe)
+ return -EINVAL;
+
retval = scmi_protocol_device_request(driver->id_table);
if (retval)
return retval;