aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/power.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi/power.c')
-rw-r--r--drivers/acpi/power.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/drivers/acpi/power.c b/drivers/acpi/power.c
index fe67a8af520e..0ba7dfbbb2ee 100644
--- a/drivers/acpi/power.c
+++ b/drivers/acpi/power.c
@@ -108,7 +108,7 @@ acpi_power_get_context(acpi_handle handle,
108 return result; 108 return result;
109 } 109 }
110 110
111 *resource = (struct acpi_power_resource *)acpi_driver_data(device); 111 *resource = acpi_driver_data(device);
112 if (!resource) 112 if (!resource)
113 return -ENODEV; 113 return -ENODEV;
114 114
@@ -442,7 +442,7 @@ static int acpi_power_seq_show(struct seq_file *seq, void *offset)
442 struct acpi_power_resource *resource = NULL; 442 struct acpi_power_resource *resource = NULL;
443 443
444 444
445 resource = (struct acpi_power_resource *)seq->private; 445 resource = seq->private;
446 446
447 if (!resource) 447 if (!resource)
448 goto end; 448 goto end;
@@ -532,10 +532,9 @@ static int acpi_power_add(struct acpi_device *device)
532 if (!device) 532 if (!device)
533 return -EINVAL; 533 return -EINVAL;
534 534
535 resource = kmalloc(sizeof(struct acpi_power_resource), GFP_KERNEL); 535 resource = kzalloc(sizeof(struct acpi_power_resource), GFP_KERNEL);
536 if (!resource) 536 if (!resource)
537 return -ENOMEM; 537 return -ENOMEM;
538 memset(resource, 0, sizeof(struct acpi_power_resource));
539 538
540 resource->device = device; 539 resource->device = device;
541 strcpy(resource->name, device->pnp.bus_id); 540 strcpy(resource->name, device->pnp.bus_id);
@@ -590,7 +589,7 @@ static int acpi_power_remove(struct acpi_device *device, int type)
590 if (!device || !acpi_driver_data(device)) 589 if (!device || !acpi_driver_data(device))
591 return -EINVAL; 590 return -EINVAL;
592 591
593 resource = (struct acpi_power_resource *)acpi_driver_data(device); 592 resource = acpi_driver_data(device);
594 593
595 acpi_power_remove_fs(device); 594 acpi_power_remove_fs(device);
596 595