Commit 8029968e authored by Uwe Kleine-König's avatar Uwe Kleine-König Committed by Dan Williams
Browse files

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: default avatarUwe Kleine-König <uwe@kleine-koenig.org>
Link: https://lore.kernel.org/r/20210205222842.34896-3-uwe@kleine-koenig.org


Signed-off-by: default avatarDan Williams <dan.j.williams@intel.com>
parent 5b8e64f1
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -178,8 +178,12 @@ static int dax_bus_remove(struct device *dev)
{
	struct dax_device_driver *dax_drv = to_dax_drv(dev->driver);
	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 = {