aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlan Jenkins <alan-jenkins@tuffmail.co.uk>2009-12-03 02:44:53 -0500
committerLen Brown <len.brown@intel.com>2009-12-09 15:54:30 -0500
commitfbe3d8942e8fd1e947e4d11a3e9e15675a1cac7e (patch)
tree59325f54e9f2d10d8bfea3a2a1ae5ca82d181c1d
parent3c0eb510697dbbb53674c72544350624a04ab5b4 (diff)
eeepc-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>
-rw-r--r--drivers/platform/x86/eeepc-laptop.c5
1 files changed, 0 insertions, 5 deletions
diff --git a/drivers/platform/x86/eeepc-laptop.c b/drivers/platform/x86/eeepc-laptop.c
index 91304342f8b6..7dde47a67997 100644
--- a/drivers/platform/x86/eeepc-laptop.c
+++ b/drivers/platform/x86/eeepc-laptop.c
@@ -1255,8 +1255,6 @@ static int __devinit eeepc_hotk_add(struct acpi_device *device)
1255 struct device *dev; 1255 struct device *dev;
1256 int result; 1256 int result;
1257 1257
1258 if (!device)
1259 return -EINVAL;
1260 pr_notice(EEEPC_HOTK_NAME "\n"); 1258 pr_notice(EEEPC_HOTK_NAME "\n");
1261 ehotk = kzalloc(sizeof(struct eeepc_hotk), GFP_KERNEL); 1259 ehotk = kzalloc(sizeof(struct eeepc_hotk), GFP_KERNEL);
1262 if (!ehotk) 1260 if (!ehotk)
@@ -1343,9 +1341,6 @@ fail_platform_driver:
1343 1341
1344static int eeepc_hotk_remove(struct acpi_device *device, int type) 1342static int eeepc_hotk_remove(struct acpi_device *device, int type)
1345{ 1343{
1346 if (!device || !acpi_driver_data(device))
1347 return -EINVAL;
1348
1349 eeepc_backlight_exit(); 1344 eeepc_backlight_exit();
1350 eeepc_rfkill_exit(); 1345 eeepc_rfkill_exit();
1351 eeepc_input_exit(); 1346 eeepc_input_exit();