public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: lv.zheng@intel.com
Cc: linux-acpi@vger.kernel.org
Subject: re: ACPI / debugger: Add IO interface to access debugger functionalities
Date: Tue, 22 Dec 2015 22:48:40 +0300	[thread overview]
Message-ID: <20151222194840.GA13871@mwanda> (raw)

Hello Lv Zheng,

The patch 8cfb0cdf07e2: "ACPI / debugger: Add IO interface to access
debugger functionalities" from Dec 3, 2015, leads to the following
static checker warning:

	drivers/acpi/acpi_dbg.c:533 acpi_aml_open()
	error: double unlock 'mutex:&acpi_aml_io.lock'

drivers/acpi/acpi_dbg.c
   498          } else {
   499                  /*
   500                   * No writer is allowed unless the debugger thread is
   501                   * ready.
   502                   */
   503                  if (!(acpi_aml_io.flags & ACPI_AML_OPENED)) {
   504                          ret = -ENODEV;
   505                          goto err_lock;

Holding lock.

   506                  }
   507          }
   508          if (acpi_aml_active_reader == file) {
   509                  pr_debug("Opening debugger interface.\n");
   510                  mutex_unlock(&acpi_aml_io.lock);
   511  
   512                  pr_debug("Initializing debugger thread.\n");
   513                  status = acpi_initialize_debugger();
   514                  if (ACPI_FAILURE(status)) {
   515                          pr_err("Failed to initialize debugger.\n");
   516                          ret = -EINVAL;
   517                          goto err_lock;

Not holding lock.

   518                  }
   519                  acpi_aml_io.flags |= ACPI_AML_OPENED;
   520                  pr_debug("Debugger thread initialized.\n");
   521  
   522                  mutex_lock(&acpi_aml_io.lock);
   523                  acpi_aml_io.out_crc.head = acpi_aml_io.out_crc.tail = 0;
   524                  acpi_aml_io.in_crc.head = acpi_aml_io.in_crc.tail = 0;
   525                  pr_debug("Debugger interface opened.\n");
   526          }
   527          acpi_aml_io.users++;
   528  err_lock:
   529          if (IS_ERR_VALUE(ret)) {
   530                  if (acpi_aml_active_reader == file)
   531                          acpi_aml_active_reader = NULL;
   532          }
   533          mutex_unlock(&acpi_aml_io.lock);

Double onlock.

   534          return ret;
   535  }

regards,
dan carpenter

             reply	other threads:[~2015-12-22 19:48 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-22 19:48 Dan Carpenter [this message]
2015-12-24  5:45 ` ACPI / debugger: Add IO interface to access debugger functionalities Zheng, Lv
2015-12-25  0:21 ` Zheng, Lv

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=20151222194840.GA13871@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=lv.zheng@intel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox