aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorAlan Jenkins <alan-jenkins@tuffmail.co.uk>2009-12-03 02:44:46 -0500
committerLen Brown <len.brown@intel.com>2009-12-09 15:54:29 -0500
commit1df8d8d4efb7bce0e44d2aa91c4c0fa7ffe613c0 (patch)
tree9223830f15ac499e97dd1336708376e9ce2dae46 /drivers
parent6dff29b63a5bf2eaf3313cb8a84f0b7520c43401 (diff)
asus-laptop: 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>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/platform/x86/asus-laptop.c6
1 files changed, 0 insertions, 6 deletions
diff --git a/drivers/platform/x86/asus-laptop.c b/drivers/platform/x86/asus-laptop.c
index b39d2bb3e75b..8af43e9b6183 100644
--- a/drivers/platform/x86/asus-laptop.c
+++ b/drivers/platform/x86/asus-laptop.c
@@ -1240,9 +1240,6 @@ static int asus_hotk_add(struct acpi_device *device)
1240{ 1240{
1241 int result; 1241 int result;
1242 1242
1243 if (!device)
1244 return -EINVAL;
1245
1246 pr_notice("Asus Laptop Support version %s\n", 1243 pr_notice("Asus Laptop Support version %s\n",
1247 ASUS_LAPTOP_VERSION); 1244 ASUS_LAPTOP_VERSION);
1248 1245
@@ -1306,9 +1303,6 @@ end:
1306 1303
1307static int asus_hotk_remove(struct acpi_device *device, int type) 1304static int asus_hotk_remove(struct acpi_device *device, int type)
1308{ 1305{
1309 if (!device || !acpi_driver_data(device))
1310 return -EINVAL;
1311
1312 kfree(hotk->name); 1306 kfree(hotk->name);
1313 kfree(hotk); 1307 kfree(hotk);
1314 1308