Commit 00fdb75b1959c2f8de8b70bfb63aca422feff2fa

Authored by Linus Torvalds

Merge branch 'agp-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/airlied/agp-2.6

* 'agp-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/airlied/agp-2.6:
  agp/hp: fail gracefully if we don't find an IOC
  agp/hp: fixup hp agp after ACPI changes
  agp: correct missing cleanup on error in agp_add_bridge

Showing 2 changed files Side-by-side Diff

drivers/char/agp/backend.c
... ... @@ -285,18 +285,22 @@
285 285 {
286 286 int error;
287 287  
288   - if (agp_off)
289   - return -ENODEV;
  288 + if (agp_off) {
  289 + error = -ENODEV;
  290 + goto err_put_bridge;
  291 + }
290 292  
291 293 if (!bridge->dev) {
292 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 299 /* Grab reference on the chipset driver. */
297 300 if (!try_module_get(bridge->driver->owner)) {
298 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 306 error = agp_backend_initialize(bridge);
... ... @@ -326,6 +330,7 @@
326 330 agp_backend_cleanup(bridge);
327 331 err_out:
328 332 module_put(bridge->driver->owner);
  333 +err_put_bridge:
329 334 agp_put_bridge(bridge);
330 335 return error;
331 336 }
drivers/char/agp/hp-agp.c
... ... @@ -488,9 +488,8 @@
488 488 handle = obj;
489 489 do {
490 490 status = acpi_get_object_info(handle, &info);
491   - if (ACPI_SUCCESS(status)) {
  491 + if (ACPI_SUCCESS(status) && (info->valid & ACPI_VALID_HID)) {
492 492 /* TBD check _CID also */
493   - info->hardware_id.string[sizeof(info->hardware_id.length)-1] = '\0';
494 493 match = (strcmp(info->hardware_id.string, "HWP0001") == 0);
495 494 kfree(info);
496 495 if (match) {
... ... @@ -508,6 +507,9 @@
508 507 status = acpi_get_parent(handle, &parent);
509 508 handle = parent;
510 509 } while (ACPI_SUCCESS(status));
  510 +
  511 + if (ACPI_FAILURE(status))
  512 + return AE_OK; /* found no enclosing IOC */
511 513  
512 514 if (hp_zx1_setup(sba_hpa + HP_ZX1_IOC_OFFSET, lba_hpa))
513 515 return AE_OK;