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