Commit fbe3d894 authored by Alan Jenkins's avatar Alan Jenkins Committed by Len Brown

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: default avatarAlan Jenkins <alan-jenkins@tuffmail.co.uk>
Signed-off-by: default avatarLen Brown <len.brown@intel.com>
parent 3c0eb510
...@@ -1255,8 +1255,6 @@ static int __devinit eeepc_hotk_add(struct acpi_device *device) ...@@ -1255,8 +1255,6 @@ static int __devinit eeepc_hotk_add(struct acpi_device *device)
struct device *dev; struct device *dev;
int result; int result;
if (!device)
return -EINVAL;
pr_notice(EEEPC_HOTK_NAME "\n"); pr_notice(EEEPC_HOTK_NAME "\n");
ehotk = kzalloc(sizeof(struct eeepc_hotk), GFP_KERNEL); ehotk = kzalloc(sizeof(struct eeepc_hotk), GFP_KERNEL);
if (!ehotk) if (!ehotk)
...@@ -1343,9 +1341,6 @@ static int __devinit eeepc_hotk_add(struct acpi_device *device) ...@@ -1343,9 +1341,6 @@ static int __devinit eeepc_hotk_add(struct acpi_device *device)
static int eeepc_hotk_remove(struct acpi_device *device, int type) static int eeepc_hotk_remove(struct acpi_device *device, int type)
{ {
if (!device || !acpi_driver_data(device))
return -EINVAL;
eeepc_backlight_exit(); eeepc_backlight_exit();
eeepc_rfkill_exit(); eeepc_rfkill_exit();
eeepc_input_exit(); eeepc_input_exit();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment