blob: 35f8fc9a08746b815be08c61735408b45d824414 [file] [log] [blame]
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: John Stultz <john.stultz@linaro.org>
Date: Thu, 2 Jan 2020 21:13:09 +0000
Subject: ANDROID: serdev: Fix platform device support
After commit 3c996ff8858 ("ANDROID: serdev: add platform device
support") landed, we started seeing boot panics on HiKey960/HiKey.
After some debugging I found the patch is passing a serdev_device->dev
pointer to match(), which expects the dev pointer to be
contained in a platform_device structure instead. When it uses
container_of, it ends up miscast and we get bad values.
Alistair suggested this fix which seems to avoid the issue.
Signed-off-by: John Stultz <john.stultz@linaro.org>
Bug: 146517987
Change-Id: I6354aeb4008fff85264a3c848c6c95fb8ca5b07a
---
drivers/tty/serdev/core.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/tty/serdev/core.c b/drivers/tty/serdev/core.c
index 37c6defcd6c1..93db998552a7 100644
--- a/drivers/tty/serdev/core.c
+++ b/drivers/tty/serdev/core.c
@@ -65,7 +65,7 @@ static int serdev_device_uevent(struct device *dev, struct kobj_uevent_env *env)
return rc;
if (dev->parent->parent->bus == &platform_bus_type)
- rc = dev->parent->parent->bus->uevent(dev, env);
+ rc = dev->parent->parent->bus->uevent(dev->parent->parent, env);
return rc;
}
@@ -110,7 +110,7 @@ static int serdev_device_match(struct device *dev, struct device_driver *drv)
return 1;
if (dev->parent->parent->bus == &platform_bus_type &&
- dev->parent->parent->bus->match(dev, drv))
+ dev->parent->parent->bus->match(dev->parent->parent, drv))
return 1;
return 0;