linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: kevin.barnett@microsemi.com
Cc: esc.storagedev@microsemi.com, linux-scsi@vger.kernel.org
Subject: [bug report] smartpqi: initial commit of Microsemi smartpqi driver
Date: Fri, 14 Oct 2016 16:59:53 +0300	[thread overview]
Message-ID: <20161014135953.GA5081@mwanda> (raw)

Hello Kevin Barnett,

The patch 6c223761eb54: "smartpqi: initial commit of Microsemi
smartpqi driver" from Jun 27, 2016, leads to the following static
checker warning:

	drivers/scsi/smartpqi/smartpqi_init.c:3513 pqi_submit_raid_request_synchronous()
	warn: inconsistent returns 'sem:&ctrl_info->sync_request_sem'.

drivers/scsi/smartpqi/smartpqi_init.c
  3437  static int pqi_submit_raid_request_synchronous(struct pqi_ctrl_info *ctrl_info,
  3438          struct pqi_iu_header *request, unsigned int flags,
  3439          struct pqi_raid_error_info *error_info, unsigned long timeout_msecs)
  3440  {
  3441          int rc;
  3442          struct pqi_io_request *io_request;
  3443          unsigned long start_jiffies;
  3444          unsigned long msecs_blocked;
  3445          size_t iu_length;
  3446  
  3447          /*
  3448           * Note that specifying PQI_SYNC_FLAGS_INTERRUPTABLE and a timeout value
  3449           * are mutually exclusive.
  3450           */
  3451  
  3452          if (flags & PQI_SYNC_FLAGS_INTERRUPTABLE) {
  3453                  if (down_interruptible(&ctrl_info->sync_request_sem))
  3454                          return -ERESTARTSYS;
  3455          } else {
  3456                  if (timeout_msecs == NO_TIMEOUT) {
  3457                          down(&ctrl_info->sync_request_sem);
  3458                  } else {
  3459                          start_jiffies = jiffies;
  3460                          if (down_timeout(&ctrl_info->sync_request_sem,
  3461                                  msecs_to_jiffies(timeout_msecs)))
  3462                                  return -ETIMEDOUT;
  3463                          msecs_blocked =
  3464                                  jiffies_to_msecs(jiffies - start_jiffies);
  3465                          if (msecs_blocked >= timeout_msecs)
  3466                                  return -ETIMEDOUT;

You probably just want to delete this if statement because it is racy.
Or unlock before returning at any rate.

  3467                          timeout_msecs -= msecs_blocked;
  3468                  }
  3469          }

regards,
dan carpenter

                 reply	other threads:[~2016-10-14 14:00 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20161014135953.GA5081@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=esc.storagedev@microsemi.com \
    --cc=kevin.barnett@microsemi.com \
    --cc=linux-scsi@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).