aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi
diff options
context:
space:
mode:
authorBjorn Helgaas <bjorn.helgaas@hp.com>2009-04-08 11:39:43 -0400
committerLen Brown <len.brown@intel.com>2009-04-11 00:36:40 -0400
commite2fb9754d27513918a4936e8cbaad50ff56cfd3d (patch)
tree0ad7d3e3631ea16c03c2d423908a11ef9c3079ec /drivers/acpi
parent50a4da890102a455e5cd3dd358c38650d07178d3 (diff)
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')
-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)
128{ 128{
129 struct acpi_button *button = seq->private; 129 struct acpi_button *button = seq->private;
130 130
131 if (!button || !button->device)
132 return 0;
133
134 seq_printf(seq, "type: %s\n", 131 seq_printf(seq, "type: %s\n",
135 acpi_device_name(button->device)); 132 acpi_device_name(button->device));
136 return 0; 133 return 0;
@@ -147,9 +144,6 @@ static int acpi_button_state_seq_show(struct seq_file *seq, void *offset)
147 acpi_status status; 144 acpi_status status;
148 unsigned long long state; 145 unsigned long long state;
149 146
150 if (!button || !button->device)
151 return 0;
152
153 status = acpi_evaluate_integer(button->device->handle, "_LID", NULL, &state); 147 status = acpi_evaluate_integer(button->device->handle, "_LID", NULL, &state);
154 seq_printf(seq, "state: %s\n", 148 seq_printf(seq, "state: %s\n",
155 ACPI_FAILURE(status) ? "unsupported" : 149 ACPI_FAILURE(status) ? "unsupported" :
@@ -171,9 +165,6 @@ static int acpi_button_add_fs(struct acpi_device *device)
171 struct proc_dir_entry *entry = NULL; 165 struct proc_dir_entry *entry = NULL;
172 struct acpi_button *button; 166 struct acpi_button *button;
173 167
174 if (!device || !acpi_driver_data(device))
175 return -EINVAL;
176
177 button = acpi_driver_data(device); 168 button = acpi_driver_data(device);
178 169
179 switch (button->type) { 170 switch (button->type) {
@@ -270,9 +261,6 @@ static void acpi_button_notify(struct acpi_device *device, u32 event)
270 struct acpi_button *button = acpi_driver_data(device); 261 struct acpi_button *button = acpi_driver_data(device);
271 struct input_dev *input; 262 struct input_dev *input;
272 263
273 if (!button || !button->device)
274 return;
275
276 switch (event) { 264 switch (event) {
277 case ACPI_FIXED_HARDWARE_EVENT: 265 case ACPI_FIXED_HARDWARE_EVENT:
278 event = ACPI_BUTTON_NOTIFY_STATUS; 266 event = ACPI_BUTTON_NOTIFY_STATUS;
@@ -305,10 +293,8 @@ static int acpi_button_resume(struct acpi_device *device)
305{ 293{
306 struct acpi_button *button; 294 struct acpi_button *button;
307 295
308 if (!device)
309 return -EINVAL;
310 button = acpi_driver_data(device); 296 button = acpi_driver_data(device);
311 if (button && button->type == ACPI_BUTTON_TYPE_LID) 297 if (button->type == ACPI_BUTTON_TYPE_LID)
312 return acpi_lid_send_state(button); 298 return acpi_lid_send_state(button);
313 return 0; 299 return 0;
314} 300}
@@ -319,9 +305,6 @@ static int acpi_button_add(struct acpi_device *device)
319 struct acpi_button *button; 305 struct acpi_button *button;
320 struct input_dev *input; 306 struct input_dev *input;
321 307
322 if (!device)
323 return -EINVAL;
324
325 button = kzalloc(sizeof(struct acpi_button), GFP_KERNEL); 308 button = kzalloc(sizeof(struct acpi_button), GFP_KERNEL);
326 if (!button) 309 if (!button)
327 return -ENOMEM; 310 return -ENOMEM;
@@ -438,9 +421,6 @@ static int acpi_button_remove(struct acpi_device *device, int type)
438{ 421{
439 struct acpi_button *button; 422 struct acpi_button *button;
440 423
441 if (!device || !acpi_driver_data(device))
442 return -EINVAL;
443
444 button = acpi_driver_data(device); 424 button = acpi_driver_data(device);
445 425
446 acpi_button_remove_fs(device); 426 acpi_button_remove_fs(device);