Skip to content

Commit

Permalink
ACPI / fan: remove no need check for device pointer
Browse files Browse the repository at this point in the history
The device pointer will not be NULL in the PM callback and ACPI driver's
add/remove callback, so checking NULL for them isn't necessary.

Signed-off-by: Aaron Lu <aaron.lu@intel.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
  • Loading branch information
Aaron Lu authored and Zhang Rui committed Oct 10, 2014
1 parent bd6ad24 commit 8dd41f7
Showing 1 changed file with 1 addition and 17 deletions.
18 changes: 1 addition & 17 deletions drivers/acpi/fan.c
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,6 @@ static int acpi_fan_add(struct acpi_device *device)
int result = 0;
struct thermal_cooling_device *cdev;

if (!device)
return -EINVAL;

strcpy(acpi_device_name(device), "Fan");
strcpy(acpi_device_class(device), ACPI_FAN_CLASS);

Expand Down Expand Up @@ -177,14 +174,7 @@ static int acpi_fan_add(struct acpi_device *device)

static int acpi_fan_remove(struct acpi_device *device)
{
struct thermal_cooling_device *cdev;

if (!device)
return -EINVAL;

cdev = acpi_driver_data(device);
if (!cdev)
return -EINVAL;
struct thermal_cooling_device *cdev = acpi_driver_data(device);

sysfs_remove_link(&device->dev.kobj, "thermal_cooling");
sysfs_remove_link(&cdev->device.kobj, "device");
Expand All @@ -196,9 +186,6 @@ static int acpi_fan_remove(struct acpi_device *device)
#ifdef CONFIG_PM_SLEEP
static int acpi_fan_suspend(struct device *dev)
{
if (!dev)
return -EINVAL;

acpi_bus_set_power(to_acpi_device(dev)->handle, ACPI_STATE_D0);

return AE_OK;
Expand All @@ -208,9 +195,6 @@ static int acpi_fan_resume(struct device *dev)
{
int result;

if (!dev)
return -EINVAL;

result = acpi_bus_update_power(to_acpi_device(dev)->handle, NULL);
if (result)
printk(KERN_ERR PREFIX "Error updating fan power state\n");
Expand Down

0 comments on commit 8dd41f7

Please sign in to comment.