From patchwork Wed Apr 8 15:39:43 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Helgaas X-Patchwork-Id: 17219 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 n38FeNWk031591 for ; Wed, 8 Apr 2009 15:40:24 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933918AbZDHPjq (ORCPT ); Wed, 8 Apr 2009 11:39:46 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S933917AbZDHPjp (ORCPT ); Wed, 8 Apr 2009 11:39:45 -0400 Received: from g4t0015.houston.hp.com ([15.201.24.18]:29267 "EHLO g4t0015.houston.hp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933890AbZDHPjo (ORCPT ); Wed, 8 Apr 2009 11:39:44 -0400 Received: from smtp2.fc.hp.com (smtp.cnd.hp.com [15.11.136.114]) by g4t0015.houston.hp.com (Postfix) with ESMTP id 52B1D8117; Wed, 8 Apr 2009 15:39:44 +0000 (UTC) Received: from localhost.localdomain (lart.fc.hp.com [15.11.146.31]) by smtp2.fc.hp.com (Postfix) with ESMTP id 182AD2BEA5C; Wed, 8 Apr 2009 15:14:58 +0000 (UTC) Received: from bob.kio (localhost [127.0.0.1]) by localhost.localdomain (Postfix) with ESMTP id EDF492615F; Wed, 8 Apr 2009 09:39:43 -0600 (MDT) Subject: [PATCH 2/6] ACPI: button: remove unnecessary null pointer checks To: Len Brown From: Bjorn Helgaas Cc: linux-acpi@vger.kernel.org Date: Wed, 08 Apr 2009 09:39:43 -0600 Message-ID: <20090408153943.12354.43191.stgit@bob.kio> In-Reply-To: <20090408153427.12354.62167.stgit@bob.kio> References: <20090408153427.12354.62167.stgit@bob.kio> User-Agent: StGit/0.14.3.347.g594a MIME-Version: 1.0 Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org Better to oops and learn about a bug than to silently cover it up. Signed-off-by: Bjorn Helgaas --- drivers/acpi/button.c | 22 +--------------------- 1 files changed, 1 insertions(+), 21 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/acpi/button.c b/drivers/acpi/button.c index 52eb06e..c463236 100644 --- a/drivers/acpi/button.c +++ b/drivers/acpi/button.c @@ -128,9 +128,6 @@ static int acpi_button_info_seq_show(struct seq_file *seq, void *offset) { struct acpi_button *button = seq->private; - if (!button || !button->device) - return 0; - seq_printf(seq, "type: %s\n", acpi_device_name(button->device)); return 0; @@ -147,9 +144,6 @@ static int acpi_button_state_seq_show(struct seq_file *seq, void *offset) acpi_status status; unsigned long long state; - if (!button || !button->device) - return 0; - status = acpi_evaluate_integer(button->device->handle, "_LID", NULL, &state); seq_printf(seq, "state: %s\n", ACPI_FAILURE(status) ? "unsupported" : @@ -171,9 +165,6 @@ static int acpi_button_add_fs(struct acpi_device *device) struct proc_dir_entry *entry = NULL; struct acpi_button *button; - if (!device || !acpi_driver_data(device)) - return -EINVAL; - button = acpi_driver_data(device); switch (button->type) { @@ -270,9 +261,6 @@ static void acpi_button_notify(struct acpi_device *device, u32 event) struct acpi_button *button = acpi_driver_data(device); struct input_dev *input; - if (!button || !button->device) - return; - switch (event) { case ACPI_FIXED_HARDWARE_EVENT: event = ACPI_BUTTON_NOTIFY_STATUS; @@ -305,10 +293,8 @@ static int acpi_button_resume(struct acpi_device *device) { struct acpi_button *button; - if (!device) - return -EINVAL; button = acpi_driver_data(device); - if (button && button->type == ACPI_BUTTON_TYPE_LID) + if (button->type == ACPI_BUTTON_TYPE_LID) return acpi_lid_send_state(button); return 0; } @@ -319,9 +305,6 @@ static int acpi_button_add(struct acpi_device *device) struct acpi_button *button; struct input_dev *input; - if (!device) - return -EINVAL; - button = kzalloc(sizeof(struct acpi_button), GFP_KERNEL); if (!button) return -ENOMEM; @@ -438,9 +421,6 @@ static int acpi_button_remove(struct acpi_device *device, int type) { struct acpi_button *button; - if (!device || !acpi_driver_data(device)) - return -EINVAL; - button = acpi_driver_data(device); acpi_button_remove_fs(device);