[PATCH 3/3] amba: check if on remove callback

Alexander Aring alex.aring at gmail.com
Mon Oct 26 11:10:29 PDT 2015


Currently we get a null pointer dereference when booting linux on RPi
which use "uart-pl011" driver. This driver doesn't implement a remove
driver callback. This patch adds a check before calling the remove
callback if the driver which use the amba bus implement such
functionality.

Signed-off-by: Alexander Aring <alex.aring at gmail.com>
---
 drivers/amba/bus.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/amba/bus.c b/drivers/amba/bus.c
index b934e11..ddd9661 100644
--- a/drivers/amba/bus.c
+++ b/drivers/amba/bus.c
@@ -70,7 +70,8 @@ static void amba_remove(struct device_d *dev)
 	struct amba_device *pcdev = to_amba_device(dev);
 	struct amba_driver *drv = to_amba_driver(dev->driver);
 
-	drv->remove(pcdev);
+	if (drv->remove)
+		drv->remove(pcdev);
 }
 
 struct bus_type amba_bustype = {
-- 
2.6.1




More information about the barebox mailing list