mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-25 18:30:06 +00:00
device-dax: Properly handle drivers without remove callback
If all resources are allocated in .probe() using devm_ functions it might make sense to not provide a .remove() callback. Then the right thing is to just return success. Signed-off-by: Uwe Kleine-König <uwe@kleine-koenig.org> Link: https://lore.kernel.org/r/20210205222842.34896-3-uwe@kleine-koenig.org Signed-off-by: Dan Williams <dan.j.williams@intel.com>
This commit is contained in:
parent
5b8e64f1ad
commit
8029968e2a
1 changed files with 5 additions and 1 deletions
|
@ -178,8 +178,12 @@ static int dax_bus_remove(struct device *dev)
|
||||||
{
|
{
|
||||||
struct dax_device_driver *dax_drv = to_dax_drv(dev->driver);
|
struct dax_device_driver *dax_drv = to_dax_drv(dev->driver);
|
||||||
struct dev_dax *dev_dax = to_dev_dax(dev);
|
struct dev_dax *dev_dax = to_dev_dax(dev);
|
||||||
|
int ret = 0;
|
||||||
|
|
||||||
return dax_drv->remove(dev_dax);
|
if (dax_drv->remove)
|
||||||
|
ret = dax_drv->remove(dev_dax);
|
||||||
|
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct bus_type dax_bus_type = {
|
static struct bus_type dax_bus_type = {
|
||||||
|
|
Loading…
Reference in a new issue