diff options
author | Alan Jenkins <alan-jenkins@tuffmail.co.uk> | 2009-12-03 02:44:47 -0500 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2009-12-09 15:54:30 -0500 |
commit | 2d5db0be4ce36b265f9ddd8debab40acd8580403 (patch) | |
tree | 1d6f838397666ff07835279d93dd9594b90ca374 | |
parent | 1df8d8d4efb7bce0e44d2aa91c4c0fa7ffe613c0 (diff) |
asus-acpi: Remove redundant NULL checks
The acpi device callbacks add, start, remove, suspend and resume can
never be called with a NULL acpi_device. Each callsite in acpi/scan.c
has to dereference the device in order to get the ops structure, e.g.
struct acpi_device *acpi_dev = to_acpi_device(dev);
struct acpi_driver *acpi_drv = acpi_dev->driver;
if (acpi_drv && acpi_drv->ops.suspend)
return acpi_drv->ops.suspend(acpi_dev, state);
Remove all checks for acpi_dev == NULL within these callbacks.
Also remove the checks for acpi_driver_data(acpi_dev) == NULL. None of
these checks could fail unless the driver does something strange
(which none of them do), the acpi core did something terribly wrong,
or we have a memory corruption issue. If this does happen then it's
best to dereference the pointer and crash noisily.
Signed-off-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
Signed-off-by: Len Brown <len.brown@intel.com>
-rw-r--r-- | drivers/platform/x86/asus_acpi.c | 6 |
1 files changed, 0 insertions, 6 deletions
diff --git a/drivers/platform/x86/asus_acpi.c b/drivers/platform/x86/asus_acpi.c index ddf5240ade8..25a7d57fe44 100644 --- a/drivers/platform/x86/asus_acpi.c +++ b/drivers/platform/x86/asus_acpi.c | |||
@@ -1334,9 +1334,6 @@ static int asus_hotk_add(struct acpi_device *device) | |||
1334 | acpi_status status = AE_OK; | 1334 | acpi_status status = AE_OK; |
1335 | int result; | 1335 | int result; |
1336 | 1336 | ||
1337 | if (!device) | ||
1338 | return -EINVAL; | ||
1339 | |||
1340 | printk(KERN_NOTICE "Asus Laptop ACPI Extras version %s\n", | 1337 | printk(KERN_NOTICE "Asus Laptop ACPI Extras version %s\n", |
1341 | ASUS_ACPI_VERSION); | 1338 | ASUS_ACPI_VERSION); |
1342 | 1339 | ||
@@ -1392,9 +1389,6 @@ end: | |||
1392 | 1389 | ||
1393 | static int asus_hotk_remove(struct acpi_device *device, int type) | 1390 | static int asus_hotk_remove(struct acpi_device *device, int type) |
1394 | { | 1391 | { |
1395 | if (!device || !acpi_driver_data(device)) | ||
1396 | return -EINVAL; | ||
1397 | |||
1398 | asus_hotk_remove_fs(device); | 1392 | asus_hotk_remove_fs(device); |
1399 | 1393 | ||
1400 | kfree(hotk); | 1394 | kfree(hotk); |