aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/ac.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi/ac.c')
-rw-r--r--drivers/acpi/ac.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/drivers/acpi/ac.c b/drivers/acpi/ac.c
index 11abc7bf777e..6daeace796a8 100644
--- a/drivers/acpi/ac.c
+++ b/drivers/acpi/ac.c
@@ -109,7 +109,7 @@ static struct proc_dir_entry *acpi_ac_dir;
109 109
110static int acpi_ac_seq_show(struct seq_file *seq, void *offset) 110static int acpi_ac_seq_show(struct seq_file *seq, void *offset)
111{ 111{
112 struct acpi_ac *ac = (struct acpi_ac *)seq->private; 112 struct acpi_ac *ac = seq->private;
113 113
114 114
115 if (!ac) 115 if (!ac)
@@ -187,7 +187,7 @@ static int acpi_ac_remove_fs(struct acpi_device *device)
187 187
188static void acpi_ac_notify(acpi_handle handle, u32 event, void *data) 188static void acpi_ac_notify(acpi_handle handle, u32 event, void *data)
189{ 189{
190 struct acpi_ac *ac = (struct acpi_ac *)data; 190 struct acpi_ac *ac = data;
191 struct acpi_device *device = NULL; 191 struct acpi_device *device = NULL;
192 192
193 193
@@ -221,10 +221,9 @@ static int acpi_ac_add(struct acpi_device *device)
221 if (!device) 221 if (!device)
222 return -EINVAL; 222 return -EINVAL;
223 223
224 ac = kmalloc(sizeof(struct acpi_ac), GFP_KERNEL); 224 ac = kzalloc(sizeof(struct acpi_ac), GFP_KERNEL);
225 if (!ac) 225 if (!ac)
226 return -ENOMEM; 226 return -ENOMEM;
227 memset(ac, 0, sizeof(struct acpi_ac));
228 227
229 ac->device = device; 228 ac->device = device;
230 strcpy(acpi_device_name(device), ACPI_AC_DEVICE_NAME); 229 strcpy(acpi_device_name(device), ACPI_AC_DEVICE_NAME);
@@ -269,7 +268,7 @@ static int acpi_ac_remove(struct acpi_device *device, int type)
269 if (!device || !acpi_driver_data(device)) 268 if (!device || !acpi_driver_data(device))
270 return -EINVAL; 269 return -EINVAL;
271 270
272 ac = (struct acpi_ac *)acpi_driver_data(device); 271 ac = acpi_driver_data(device);
273 272
274 status = acpi_remove_notify_handler(device->handle, 273 status = acpi_remove_notify_handler(device->handle,
275 ACPI_ALL_NOTIFY, acpi_ac_notify); 274 ACPI_ALL_NOTIFY, acpi_ac_notify);