From patchwork Thu Aug 6 22:57:54 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Morton X-Patchwork-Id: 39704 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n76MxLoh000974 for ; Thu, 6 Aug 2009 22:59:22 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756451AbZHFW7P (ORCPT ); Thu, 6 Aug 2009 18:59:15 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1756491AbZHFW7P (ORCPT ); Thu, 6 Aug 2009 18:59:15 -0400 Received: from smtp1.linux-foundation.org ([140.211.169.13]:34026 "EHLO smtp1.linux-foundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756455AbZHFW7O (ORCPT ); Thu, 6 Aug 2009 18:59:14 -0400 Received: from imap1.linux-foundation.org (imap1.linux-foundation.org [140.211.169.55]) by smtp1.linux-foundation.org (8.14.2/8.13.5/Debian-3ubuntu1.1) with ESMTP id n76Mvsei015715 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 6 Aug 2009 15:57:55 -0700 Received: from localhost.localdomain (localhost [127.0.0.1]) by imap1.linux-foundation.org (8.13.5.20060308/8.13.5/Debian-3ubuntu1.1) with ESMTP id n76Mvs1F024250; Thu, 6 Aug 2009 15:57:54 -0700 Message-Id: <200908062257.n76Mvs1F024250@imap1.linux-foundation.org> Subject: [patch 6/9] acpi: don't free non-existent backlight in acpi video module To: lenb@kernel.org Cc: linux-acpi@vger.kernel.org, akpm@linux-foundation.org, keithp@keithp.com, rui.zhang@intel.com From: akpm@linux-foundation.org Date: Thu, 06 Aug 2009 15:57:54 -0700 X-Spam-Status: No, hits=-3.511 required=5 tests=AWL, BAYES_00, OSDL_HEADER_SUBJECT_BRACKETED X-Spam-Checker-Version: SpamAssassin 3.2.4-osdl_revision__1.47__ X-MIMEDefang-Filter: lf$Revision: 1.188 $ X-Scanned-By: MIMEDefang 2.63 on 140.211.169.13 Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org From: Keith Packard acpi_video_put_one_device was attempting to remove sysfs entries and unregister a backlight device without first checking that said backlight device structure had been created. Signed-off-by: Keith Packard Cc: Zhang Rui Cc: Len Brown Signed-off-by: Andrew Morton --- drivers/acpi/video.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff -puN drivers/acpi/video.c~acpi-dont-free-non-existent-backlight-in-acpi-video-module drivers/acpi/video.c --- a/drivers/acpi/video.c~acpi-dont-free-non-existent-backlight-in-acpi-video-module +++ a/drivers/acpi/video.c @@ -2004,8 +2004,11 @@ static int acpi_video_bus_put_one_device status = acpi_remove_notify_handler(device->dev->handle, ACPI_DEVICE_NOTIFY, acpi_video_device_notify); - sysfs_remove_link(&device->backlight->dev.kobj, "device"); - backlight_device_unregister(device->backlight); + if (device->backlight) { + sysfs_remove_link(&device->backlight->dev.kobj, "device"); + backlight_device_unregister(device->backlight); + device->backlight = NULL; + } if (device->cdev) { sysfs_remove_link(&device->dev->dev.kobj, "thermal_cooling");