diff options
author | Chuck Ebbert <cebbert@redhat.com> | 2007-05-09 18:05:48 -0400 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2007-05-10 03:30:41 -0400 |
commit | 22fe4c2114e29477ca6738729c074ee8f60d3b73 (patch) | |
tree | af07c5267dd3d66b75bc4d3083eb2e946393f09f /drivers/acpi | |
parent | 38ff4ffc039ba5a5878f2dcbb03d87c3a1f02f1b (diff) |
ACPI: dock: fix opps after dock driver fails to initialize
The driver tests the dock_station pointer for nonnull
to check whether it has initialized properly. But in
some cases dock_station will be non-null after being
freed when driver init fails. Fix by zeroing the
pointer after freeing.
Signed-off-by: Chuck Ebbert <cebbert@redhat.com>
Signed-off-by: Kristen Carlson Accardi <kristen.c.accardi@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi')
-rw-r--r-- | drivers/acpi/dock.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/acpi/dock.c b/drivers/acpi/dock.c index 9ddc3f189bb7..f66f4f7767ac 100644 --- a/drivers/acpi/dock.c +++ b/drivers/acpi/dock.c | |||
@@ -715,6 +715,7 @@ static int dock_add(acpi_handle handle) | |||
715 | if (ret) { | 715 | if (ret) { |
716 | printk(KERN_ERR PREFIX "Error %d registering dock device\n", ret); | 716 | printk(KERN_ERR PREFIX "Error %d registering dock device\n", ret); |
717 | kfree(dock_station); | 717 | kfree(dock_station); |
718 | dock_station = NULL; | ||
718 | return ret; | 719 | return ret; |
719 | } | 720 | } |
720 | ret = device_create_file(&dock_device.dev, &dev_attr_docked); | 721 | ret = device_create_file(&dock_device.dev, &dev_attr_docked); |
@@ -722,6 +723,7 @@ static int dock_add(acpi_handle handle) | |||
722 | printk("Error %d adding sysfs file\n", ret); | 723 | printk("Error %d adding sysfs file\n", ret); |
723 | platform_device_unregister(&dock_device); | 724 | platform_device_unregister(&dock_device); |
724 | kfree(dock_station); | 725 | kfree(dock_station); |
726 | dock_station = NULL; | ||
725 | return ret; | 727 | return ret; |
726 | } | 728 | } |
727 | ret = device_create_file(&dock_device.dev, &dev_attr_undock); | 729 | ret = device_create_file(&dock_device.dev, &dev_attr_undock); |
@@ -730,6 +732,7 @@ static int dock_add(acpi_handle handle) | |||
730 | device_remove_file(&dock_device.dev, &dev_attr_docked); | 732 | device_remove_file(&dock_device.dev, &dev_attr_docked); |
731 | platform_device_unregister(&dock_device); | 733 | platform_device_unregister(&dock_device); |
732 | kfree(dock_station); | 734 | kfree(dock_station); |
735 | dock_station = NULL; | ||
733 | return ret; | 736 | return ret; |
734 | } | 737 | } |
735 | ret = device_create_file(&dock_device.dev, &dev_attr_uid); | 738 | ret = device_create_file(&dock_device.dev, &dev_attr_uid); |
@@ -739,6 +742,7 @@ static int dock_add(acpi_handle handle) | |||
739 | device_remove_file(&dock_device.dev, &dev_attr_undock); | 742 | device_remove_file(&dock_device.dev, &dev_attr_undock); |
740 | platform_device_unregister(&dock_device); | 743 | platform_device_unregister(&dock_device); |
741 | kfree(dock_station); | 744 | kfree(dock_station); |
745 | dock_station = NULL; | ||
742 | return ret; | 746 | return ret; |
743 | } | 747 | } |
744 | 748 | ||
@@ -751,6 +755,7 @@ static int dock_add(acpi_handle handle) | |||
751 | dd = alloc_dock_dependent_device(handle); | 755 | dd = alloc_dock_dependent_device(handle); |
752 | if (!dd) { | 756 | if (!dd) { |
753 | kfree(dock_station); | 757 | kfree(dock_station); |
758 | dock_station = NULL; | ||
754 | ret = -ENOMEM; | 759 | ret = -ENOMEM; |
755 | goto dock_add_err_unregister; | 760 | goto dock_add_err_unregister; |
756 | } | 761 | } |
@@ -779,6 +784,7 @@ dock_add_err_unregister: | |||
779 | device_remove_file(&dock_device.dev, &dev_attr_uid); | 784 | device_remove_file(&dock_device.dev, &dev_attr_uid); |
780 | platform_device_unregister(&dock_device); | 785 | platform_device_unregister(&dock_device); |
781 | kfree(dock_station); | 786 | kfree(dock_station); |
787 | dock_station = NULL; | ||
782 | return ret; | 788 | return ret; |
783 | } | 789 | } |
784 | 790 | ||
@@ -813,6 +819,7 @@ static int dock_remove(void) | |||
813 | 819 | ||
814 | /* free dock station memory */ | 820 | /* free dock station memory */ |
815 | kfree(dock_station); | 821 | kfree(dock_station); |
822 | dock_station = NULL; | ||
816 | return 0; | 823 | return 0; |
817 | } | 824 | } |
818 | 825 | ||