From patchwork Sun Jul 12 06:47:31 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Keith Packard X-Patchwork-Id: 35231 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 n6C6vxa8000863 for ; Sun, 12 Jul 2009 06:57:59 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751424AbZGLG5e (ORCPT ); Sun, 12 Jul 2009 02:57:34 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751485AbZGLG5e (ORCPT ); Sun, 12 Jul 2009 02:57:34 -0400 Received: from home.keithp.com ([63.227.221.253]:49453 "EHLO keithp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751424AbZGLG5d (ORCPT ); Sun, 12 Jul 2009 02:57:33 -0400 X-Greylist: delayed 579 seconds by postgrey-1.27 at vger.kernel.org; Sun, 12 Jul 2009 02:57:33 EDT Received: from localhost (localhost [127.0.0.1]) by keithp.com (Postfix) with ESMTP id B34C3BB4031; Sat, 11 Jul 2009 23:47:54 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at keithp.com Received: from keithp.com ([127.0.0.1]) by localhost (keithp.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id R0dNyp3KCxzt; Sat, 11 Jul 2009 23:47:51 -0700 (PDT) Received: by keithp.com (Postfix, from userid 1033) id E0CA5BB4032; Sat, 11 Jul 2009 23:47:51 -0700 (PDT) Received: from koto.keithp.com (localhost [127.0.0.1]) by keithp.com (Postfix) with ESMTP id D86F9B98048; Sat, 11 Jul 2009 23:47:50 -0700 (PDT) Received: by koto.keithp.com (Postfix, from userid 1488) id 48EC1782245; Sat, 11 Jul 2009 23:47:38 -0700 (PDT) From: keithp@keithp.com To: rui.zhang@intel.com Cc: linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, keithp@keithp.com Subject: [PATCH 1/2] acpi: don't free non-existant backlight in acpi video module Date: Sat, 11 Jul 2009 23:47:31 -0700 Message-Id: <1247381251-27031-1-git-send-email-keithp@keithp.com> X-Mailer: git-send-email 1.6.3.3 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 Acked-by: Zhang Rui --- drivers/acpi/video.c | 7 +++++-- 1 files changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c index 8851315..60ea984 100644 --- a/drivers/acpi/video.c +++ b/drivers/acpi/video.c @@ -2004,8 +2004,11 @@ static int acpi_video_bus_put_one_device(struct acpi_video_device *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");