* [PATCH 1/2] firmware: arm_ffa: Ensure drivers provide a probe function
@ 2021-06-21 20:16 Uwe Kleine-König
2021-06-21 20:16 ` [PATCH 2/2] firmware: arm_ffa: Simplify " Uwe Kleine-König
2021-06-23 13:56 ` [PATCH 1/2] firmware: arm_ffa: Ensure drivers provide a " Sudeep Holla
0 siblings, 2 replies; 3+ messages in thread
From: Uwe Kleine-König @ 2021-06-21 20:16 UTC (permalink / raw)
To: Sudeep Holla; +Cc: Jens Wiklander, linux-arm-kernel, kernel
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.
Fixes: e781858488b9 ("firmware: arm_ffa: Add initial FFA bus support for device enumeration")
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
drivers/firmware/arm_ffa/bus.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/firmware/arm_ffa/bus.c b/drivers/firmware/arm_ffa/bus.c
index 83166e02b191..d2cc24319626 100644
--- a/drivers/firmware/arm_ffa/bus.c
+++ b/drivers/firmware/arm_ffa/bus.c
@@ -99,6 +99,9 @@ int ffa_driver_register(struct ffa_driver *driver, struct module *owner,
{
int ret;
+ if (!driver->probe)
+ return -EINVAL;
+
driver->driver.bus = &ffa_bus_type;
driver->driver.name = driver->name;
driver->driver.owner = owner;
--
2.30.2
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH 2/2] firmware: arm_ffa: Simplify probe function
2021-06-21 20:16 [PATCH 1/2] firmware: arm_ffa: Ensure drivers provide a probe function Uwe Kleine-König
@ 2021-06-21 20:16 ` Uwe Kleine-König
2021-06-23 13:56 ` [PATCH 1/2] firmware: arm_ffa: Ensure drivers provide a " Sudeep Holla
1 sibling, 0 replies; 3+ messages in thread
From: Uwe Kleine-König @ 2021-06-21 20:16 UTC (permalink / raw)
To: Sudeep Holla; +Cc: Jens Wiklander, linux-arm-kernel, kernel
When the driver core calls the probe callback it already checked that
the devices match, so there is no need to call the match callback again.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
drivers/firmware/arm_ffa/bus.c | 3 ---
1 file changed, 3 deletions(-)
diff --git a/drivers/firmware/arm_ffa/bus.c b/drivers/firmware/arm_ffa/bus.c
index d2cc24319626..00fe595a5bc8 100644
--- a/drivers/firmware/arm_ffa/bus.c
+++ b/drivers/firmware/arm_ffa/bus.c
@@ -46,9 +46,6 @@ static int ffa_device_probe(struct device *dev)
struct ffa_driver *ffa_drv = to_ffa_driver(dev->driver);
struct ffa_device *ffa_dev = to_ffa_dev(dev);
- if (!ffa_device_match(dev, dev->driver))
- return -ENODEV;
-
return ffa_drv->probe(ffa_dev);
}
--
2.30.2
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 1/2] firmware: arm_ffa: Ensure drivers provide a probe function
2021-06-21 20:16 [PATCH 1/2] firmware: arm_ffa: Ensure drivers provide a probe function Uwe Kleine-König
2021-06-21 20:16 ` [PATCH 2/2] firmware: arm_ffa: Simplify " Uwe Kleine-König
@ 2021-06-23 13:56 ` Sudeep Holla
1 sibling, 0 replies; 3+ messages in thread
From: Sudeep Holla @ 2021-06-23 13:56 UTC (permalink / raw)
To: Uwe Kleine-König
Cc: Sudeep Holla, Jens Wiklander, linux-arm-kernel, kernel
On Mon, 21 Jun 2021 22:16:51 +0200, Uwe Kleine-König wrote:
> 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.
Applied to sudeep.holla/linux (for-next/ffa), thanks!
[1/2] firmware: arm_ffa: Ensure drivers provide a probe function
https://git.kernel.org/sudeep.holla/c/80421ba63f
[2/2] firmware: arm_ffa: Simplify probe function
https://git.kernel.org/sudeep.holla/c/bc5ea7449a
--
Regards,
Sudeep
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-06-23 13:58 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-21 20:16 [PATCH 1/2] firmware: arm_ffa: Ensure drivers provide a probe function Uwe Kleine-König
2021-06-21 20:16 ` [PATCH 2/2] firmware: arm_ffa: Simplify " Uwe Kleine-König
2021-06-23 13:56 ` [PATCH 1/2] firmware: arm_ffa: Ensure drivers provide a " Sudeep Holla
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).