Thread (8 messages) 8 messages, 4 authors, 2012-10-25

Re: [PATCH 2/2] Improve container_notify_cb() to support container hot-remove.

From: Tang Chen <hidden>
Date: 2012-10-24 01:52:33

On 10/24/2012 05:54 AM, Mike Maslenkin wrote:
On Tue, 2012-10-23 at 21:10 +0800, Tang Chen wrote:
quoted
+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?
Oh yes, my mistake.

And do the allocation after stopping container would be better. :)

Thanks.

Mike.
  
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help