summaryrefslogtreecommitdiffstats
path: root/drivers/dax
diff options
context:
space:
mode:
authorUwe Kleine-König <uwe@kleine-koenig.org>2021-02-05 23:28:39 +0100
committerDan Williams <dan.j.williams@intel.com>2021-02-17 04:41:26 +0100
commit8029968e2ae02361f376751459dc644b45970b40 (patch)
treee6a27cb333ff2c7afecf017d9bc8ff31d980bd41 /drivers/dax
parentdevice-dax: Prevent registering drivers without probe callback (diff)
downloadlinux-8029968e2ae02361f376751459dc644b45970b40.tar.xz
linux-8029968e2ae02361f376751459dc644b45970b40.zip
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>
Diffstat (limited to 'drivers/dax')
-rw-r--r--drivers/dax/bus.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/dax/bus.c b/drivers/dax/bus.c
index 2b29728ec2fd..ef53da441c5d 100644
--- a/drivers/dax/bus.c
+++ b/drivers/dax/bus.c
@@ -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 = {