Re: [PATCH 2/2] Improve container_notify_cb() to support container hot-remove.
From: Mike Maslenkin <hidden>
Date: 2012-10-23 22:06:21
From: Mike Maslenkin <hidden>
Date: 2012-10-23 22:06:21
On Tue, 2012-10-23 at 21:10 +0800, Tang Chen wrote:
+static int container_device_remove(struct acpi_device *device)
+{
+ int ret;
+ struct acpi_eject_event *ej_event;
+
+ ej_event = kmalloc(sizeof(*ej_event), GFP_KERNEL);
+ if (!ej_event)
+ return -ENOMEM;
+
+ ej_event->device = device;
+ ej_event->event = ACPI_NOTIFY_EJECT_REQUEST;
+
+ /* stop container device at first */
+ ret = acpi_bus_trim(device, 0);
+ printk(KERN_WARNING "acpi_bus_trim stop return %x\n", ret);
+ if (ret)
+ return ret;
+Looks like kfree() is missed here. Would it be better to stop container before event allocation? Mike.