[lkml]   [2020]   [Jul]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Patch in this message
Subject[PATCH 5.4 010/109] gpu: host1x: Detach driver on unregister
From: Thierry Reding <>

[ Upstream commit d9a0a05bf8c76e6dc79230669a8b5d685b168c30 ]

Currently when a host1x device driver is unregistered, it is not
detached from the host1x controller, which means that the device
will stay around and when the driver is registered again, it may
bind to the old, stale device rather than the new one that was
created from scratch upon driver registration. This in turn can
cause various weird crashes within the driver core because it is
confronted with a device that was already deleted.

Fix this by detaching the driver from the host1x controller when
it is unregistered. This ensures that the deleted device also is
no longer present in the device list that drivers will bind to.

Reported-by: Sowjanya Komatineni <>
Signed-off-by: Thierry Reding <>
Tested-by: Sowjanya Komatineni <>
Signed-off-by: Thierry Reding <>
Signed-off-by: Sasha Levin <>
drivers/gpu/host1x/bus.c | 9 +++++++++
1 file changed, 9 insertions(+)

diff --git a/drivers/gpu/host1x/bus.c b/drivers/gpu/host1x/bus.c
index 742aa9ff21b87..fcda8621ae6f9 100644
--- a/drivers/gpu/host1x/bus.c
+++ b/drivers/gpu/host1x/bus.c
@@ -686,8 +686,17 @@ EXPORT_SYMBOL(host1x_driver_register_full);
void host1x_driver_unregister(struct host1x_driver *driver)
+ struct host1x *host1x;

+ mutex_lock(&devices_lock);
+ list_for_each_entry(host1x, &devices, list)
+ host1x_detach_driver(host1x, driver);
+ mutex_unlock(&devices_lock);

 \ /
  Last update: 2020-07-14 20:49    [W:0.242 / U:2.088 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site