From: Dan Carpenter <dan.carpenter@oracle.com>
To: wency@cn.fujitsu.com
Cc: linux-acpi@vger.kernel.org
Subject: re: acpi_memhotplug.c: don't allow to eject the memory device if it is being used
Date: Mon, 5 Nov 2012 21:11:33 +0300 [thread overview]
Message-ID: <20121105181133.GA21846@elgon.mountain> (raw)
Hello Wen Congyang,
The patch 306859f13dc1: "acpi_memhotplug.c: don't allow to eject the
memory device if it is being used" from Nov 3, 2012, leads to the
following Smatch warning:
drivers/acpi/acpi_memhotplug.c:367 acpi_memory_remove_memory()
warn: inconsistent returns mutex:&mem_device->list_lock:
locked (357,361) unlocked (367)
341 static int acpi_memory_remove_memory(struct acpi_memory_device *mem_device)
342 {
343 int result;
344 struct acpi_memory_info *info, *n;
345
346 mutex_lock(&mem_device->list_lock);
347 list_for_each_entry_safe(info, n, &mem_device->res_list, list) {
348 if (info->failed)
349 /* The kernel does not use this memory block */
350 continue;
351
352 if (!info->enabled)
353 /*
354 * The kernel uses this memory block, but it may be not
355 * managed by us.
356 */
357 return -EBUSY;
^^^^^^^^^^^^^
358
359 result = remove_memory(info->start_addr, info->length);
360 if (result)
361 return result;
^^^^^^^^^^^^^^
Unlock before returning?
362 list_del(&info->list);
363 kfree(info);
364 }
365 mutex_unlock(&mem_device->list_lock);
366
367 return 0;
368 }
regards,
dan carpenter
next reply other threads:[~2012-11-05 18:11 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-05 18:11 Dan Carpenter [this message]
2012-11-06 2:10 ` acpi_memhotplug.c: don't allow to eject the memory device if it is being used Wen Congyang
2012-11-06 14:05 ` Dan Carpenter
2012-11-07 1:39 ` Wen Congyang
2012-11-08 9:33 ` Wen Congyang
2012-11-08 9:58 ` Rafael J. Wysocki
2012-11-08 10:03 ` Wen Congyang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20121105181133.GA21846@elgon.mountain \
--to=dan.carpenter@oracle.com \
--cc=linux-acpi@vger.kernel.org \
--cc=wency@cn.fujitsu.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.