From: Zhao Yakui Date: Fri, 15 Feb 2008 00:34:37 +0000 (+0800) Subject: ACPI: thermal: Check whether cooling device exists before unregistering X-Git-Tag: v2.6.25-rc3~95^2^2 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f28bb45e2863173a7464d98907677e903f42c68b;p=linux-2.6 ACPI: thermal: Check whether cooling device exists before unregistering OS should check whether the cooling device exists before it is unregistered. If it doesn't exists, it is unnecessary to remove the sysfs link and call the function of thermal_cooling_device_unregister. http://bugzilla.kernel.org/show_bug.cgi?id=9982 Signed-off-by: Zhao Yakui Tested-by : Dhaval Giani Signed-off-by: Len Brown --- diff --git a/drivers/acpi/processor_core.c b/drivers/acpi/processor_core.c index 75ccf5d18b..697335c842 100644 --- a/drivers/acpi/processor_core.c +++ b/drivers/acpi/processor_core.c @@ -809,10 +809,12 @@ static int acpi_processor_remove(struct acpi_device *device, int type) acpi_processor_remove_fs(device); - sysfs_remove_link(&device->dev.kobj, "thermal_cooling"); - sysfs_remove_link(&pr->cdev->device.kobj, "device"); - thermal_cooling_device_unregister(pr->cdev); - pr->cdev = NULL; + if (pr->cdev) { + sysfs_remove_link(&device->dev.kobj, "thermal_cooling"); + sysfs_remove_link(&pr->cdev->device.kobj, "device"); + thermal_cooling_device_unregister(pr->cdev); + pr->cdev = NULL; + } processors[pr->id] = NULL;