Skip to content

Commit 244f5d5

Browse files
committed
firmware: arm_ffa: Add missing remove callback to ffa_bus_type
Currently the arm_ffa firmware driver can be built as module and hence all the users of FFA driver. If any driver on the ffa bus is removed or unregistered, the remove callback on all the device bound to the driver being removed should be callback. For that to happen, we must register a remove callback on the ffa_bus which is currently missing. This results in the probe getting called again without the previous remove callback on a device which may result in kernel crash. Fix the issue by registering the remove callback on the FFA bus. Link: https://lore.kernel.org/r/[email protected] Fixes: e781858 ("firmware: arm_ffa: Add initial FFA bus support for device enumeration") Reported-by: Jens Wiklander <[email protected]> Tested-by: Jens Wiklander <[email protected]> Signed-off-by: Sudeep Holla <[email protected]>
1 parent 6880fa6 commit 244f5d5

File tree

1 file changed

+8
-0
lines changed
  • drivers/firmware/arm_ffa

1 file changed

+8
-0
lines changed

drivers/firmware/arm_ffa/bus.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,13 @@ static int ffa_device_probe(struct device *dev)
4949
return ffa_drv->probe(ffa_dev);
5050
}
5151

52+
static void ffa_device_remove(struct device *dev)
53+
{
54+
struct ffa_driver *ffa_drv = to_ffa_driver(dev->driver);
55+
56+
ffa_drv->remove(to_ffa_dev(dev));
57+
}
58+
5259
static int ffa_device_uevent(struct device *dev, struct kobj_uevent_env *env)
5360
{
5461
struct ffa_device *ffa_dev = to_ffa_dev(dev);
@@ -86,6 +93,7 @@ struct bus_type ffa_bus_type = {
8693
.name = "arm_ffa",
8794
.match = ffa_device_match,
8895
.probe = ffa_device_probe,
96+
.remove = ffa_device_remove,
8997
.uevent = ffa_device_uevent,
9098
.dev_groups = ffa_device_attributes_groups,
9199
};

0 commit comments

Comments
 (0)