summaryrefslogtreecommitdiffstats
path: root/drivers/acpi/button.c
diff options
context:
space:
mode:
authorBjorn Helgaas <bjorn.helgaas@hp.com>2009-04-08 15:39:43 +0000
committerLen Brown <len.brown@intel.com>2009-04-11 00:36:40 -0400
commite2fb9754d27513918a4936e8cbaad50ff56cfd3d (patch)
tree0ad7d3e3631ea16c03c2d423908a11ef9c3079ec /drivers/acpi/button.c
parent50a4da890102a455e5cd3dd358c38650d07178d3 (diff)
downloadtalos-op-linux-e2fb9754d27513918a4936e8cbaad50ff56cfd3d.tar.gz
talos-op-linux-e2fb9754d27513918a4936e8cbaad50ff56cfd3d.zip
ACPI: button: remove unnecessary null pointer checks
Better to oops and learn about a bug than to silently cover it up. Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com> Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi/button.c')
-rw-r--r--drivers/acpi/button.c22
1 files changed, 1 insertions, 21 deletions
diff --git a/drivers/acpi/button.c b/drivers/acpi/button.c
index 52eb06ea4f80..c4632366226f 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);
OpenPOWER on IntegriCloud