diff options
Diffstat (limited to 'drivers/char/agp/backend.c')
-rw-r--r-- | drivers/char/agp/backend.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/drivers/char/agp/backend.c b/drivers/char/agp/backend.c index a56ca080e108..c3ab46da51a3 100644 --- a/drivers/char/agp/backend.c +++ b/drivers/char/agp/backend.c | |||
@@ -285,18 +285,22 @@ int agp_add_bridge(struct agp_bridge_data *bridge) | |||
285 | { | 285 | { |
286 | int error; | 286 | int error; |
287 | 287 | ||
288 | if (agp_off) | 288 | if (agp_off) { |
289 | return -ENODEV; | 289 | error = -ENODEV; |
290 | goto err_put_bridge; | ||
291 | } | ||
290 | 292 | ||
291 | if (!bridge->dev) { | 293 | if (!bridge->dev) { |
292 | printk (KERN_DEBUG PFX "Erk, registering with no pci_dev!\n"); | 294 | printk (KERN_DEBUG PFX "Erk, registering with no pci_dev!\n"); |
293 | return -EINVAL; | 295 | error = -EINVAL; |
296 | goto err_put_bridge; | ||
294 | } | 297 | } |
295 | 298 | ||
296 | /* Grab reference on the chipset driver. */ | 299 | /* Grab reference on the chipset driver. */ |
297 | if (!try_module_get(bridge->driver->owner)) { | 300 | if (!try_module_get(bridge->driver->owner)) { |
298 | dev_info(&bridge->dev->dev, "can't lock chipset driver\n"); | 301 | dev_info(&bridge->dev->dev, "can't lock chipset driver\n"); |
299 | return -EINVAL; | 302 | error = -EINVAL; |
303 | goto err_put_bridge; | ||
300 | } | 304 | } |
301 | 305 | ||
302 | error = agp_backend_initialize(bridge); | 306 | error = agp_backend_initialize(bridge); |
@@ -326,6 +330,7 @@ frontend_err: | |||
326 | agp_backend_cleanup(bridge); | 330 | agp_backend_cleanup(bridge); |
327 | err_out: | 331 | err_out: |
328 | module_put(bridge->driver->owner); | 332 | module_put(bridge->driver->owner); |
333 | err_put_bridge: | ||
329 | agp_put_bridge(bridge); | 334 | agp_put_bridge(bridge); |
330 | return error; | 335 | return error; |
331 | } | 336 | } |