From 51b0e90ec6f978bcc5ebe970acd0c62cbb341575 Mon Sep 17 00:00:00 2001 From: Alexander Aring Date: Mon, 26 Oct 2015 19:10:29 +0100 Subject: amba: check if on remove callback 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 Signed-off-by: Sascha Hauer --- drivers/amba/bus.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'drivers/amba/bus.c') diff --git a/drivers/amba/bus.c b/drivers/amba/bus.c index b934e1182d..ddd9661806 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 = { -- cgit v1.2.3