summaryrefslogtreecommitdiffstats
path: root/drivers/base
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2015-03-16 12:59:34 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2015-03-17 07:24:50 +0100
commite0899dfa3b15886d35280199e2dbd2d7810bf8b5 (patch)
tree195573943ed1cfdec389330e08049de9d271ed45 /drivers/base
parent0f3366ba853dafc6c2005771bcd1a97769f764dd (diff)
downloadbarebox-e0899dfa3b15886d35280199e2dbd2d7810bf8b5.tar.gz
barebox-e0899dfa3b15886d35280199e2dbd2d7810bf8b5.tar.xz
driver: Call remove function only when available
The bus implementations currently call the drivers remove hook unconditionally, but this hook is seldomly populated. Only call it when it's actually populated. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers/base')
-rw-r--r--drivers/base/platform.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/base/platform.c b/drivers/base/platform.c
index e053ec7bbc..85bdfb0149 100644
--- a/drivers/base/platform.c
+++ b/drivers/base/platform.c
@@ -29,7 +29,8 @@ static int platform_probe(struct device_d *dev)
static void platform_remove(struct device_d *dev)
{
- dev->driver->remove(dev);
+ if (dev->driver->remove)
+ dev->driver->remove(dev);
}
int platform_driver_register(struct driver_d *drv)