diff options
author | Thierry Reding <treding@nvidia.com> | 2014-11-05 05:43:26 -0500 |
---|---|---|
committer | Thierry Reding <treding@nvidia.com> | 2015-01-23 06:07:00 -0500 |
commit | 536e1715226c94037df12f7c6280cbe0f6009f92 (patch) | |
tree | 142cc1db3c1d1cb714d6c14b3217764475636bc9 | |
parent | 281d1bbd34b734e4f22b30b6f3b673dda46a7470 (diff) |
gpu: host1x: Call ->remove() only when a device is bound
When a driver's ->probe() function fails, the host1x bus must not call
its ->remove() function because the driver will already have cleaned up
in the error handling path in ->probe().
Signed-off-by: Thierry Reding <treding@nvidia.com>
-rw-r--r-- | drivers/gpu/host1x/bus.c | 9 | ||||
-rw-r--r-- | include/linux/host1x.h | 2 |
2 files changed, 9 insertions, 2 deletions
diff --git a/drivers/gpu/host1x/bus.c b/drivers/gpu/host1x/bus.c index aaf54859adb0..e4182e68e29c 100644 --- a/drivers/gpu/host1x/bus.c +++ b/drivers/gpu/host1x/bus.c | |||
@@ -116,7 +116,10 @@ static void host1x_subdev_register(struct host1x_device *device, | |||
116 | if (list_empty(&device->subdevs)) { | 116 | if (list_empty(&device->subdevs)) { |
117 | err = device->driver->probe(device); | 117 | err = device->driver->probe(device); |
118 | if (err < 0) | 118 | if (err < 0) |
119 | dev_err(&device->dev, "probe failed: %d\n", err); | 119 | dev_err(&device->dev, "probe failed for %ps: %d\n", |
120 | device->driver, err); | ||
121 | else | ||
122 | device->bound = true; | ||
120 | } | 123 | } |
121 | } | 124 | } |
122 | 125 | ||
@@ -130,10 +133,12 @@ static void __host1x_subdev_unregister(struct host1x_device *device, | |||
130 | * If all subdevices have been activated, we're about to remove the | 133 | * If all subdevices have been activated, we're about to remove the |
131 | * first active subdevice, so unload the driver first. | 134 | * first active subdevice, so unload the driver first. |
132 | */ | 135 | */ |
133 | if (list_empty(&device->subdevs)) { | 136 | if (list_empty(&device->subdevs) && device->bound) { |
134 | err = device->driver->remove(device); | 137 | err = device->driver->remove(device); |
135 | if (err < 0) | 138 | if (err < 0) |
136 | dev_err(&device->dev, "remove failed: %d\n", err); | 139 | dev_err(&device->dev, "remove failed: %d\n", err); |
140 | |||
141 | device->bound = false; | ||
137 | } | 142 | } |
138 | 143 | ||
139 | /* | 144 | /* |
diff --git a/include/linux/host1x.h b/include/linux/host1x.h index bb9840fd1e18..7890b553d12e 100644 --- a/include/linux/host1x.h +++ b/include/linux/host1x.h | |||
@@ -272,6 +272,8 @@ struct host1x_device { | |||
272 | 272 | ||
273 | struct mutex clients_lock; | 273 | struct mutex clients_lock; |
274 | struct list_head clients; | 274 | struct list_head clients; |
275 | |||
276 | bool bound; | ||
275 | }; | 277 | }; |
276 | 278 | ||
277 | static inline struct host1x_device *to_host1x_device(struct device *dev) | 279 | static inline struct host1x_device *to_host1x_device(struct device *dev) |