All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: eo@nebensachen.de
Cc: linux-ide@vger.kernel.org
Subject: re: libata: Implement disk shock protection support
Date: Wed, 17 Feb 2016 22:24:35 +0300	[thread overview]
Message-ID: <20160217192435.GA14960@mwanda> (raw)

Hello Elias Oltmanns,

The patch 45fabbb77bd9: "libata: Implement disk shock protection
support" from Sep 21, 2008, leads to the following Smatch
warning:

  drivers/ata/libata-scsi.c:206 ata_scsi_park_show()
  warn: inconsistent returns 'irqsave:flags'.
	  Locked on:   line 206
	  Unlocked on: line 206

drivers/ata/libata-scsi.c
   170  static ssize_t ata_scsi_park_show(struct device *device,
   171                                    struct device_attribute *attr, char *buf)
   172  {
   173          struct scsi_device *sdev = to_scsi_device(device);
   174          struct ata_port *ap;
   175          struct ata_link *link;
   176          struct ata_device *dev;
   177          unsigned long flags, now;
   178          unsigned int uninitialized_var(msecs);
   179          int rc = 0;
   180  
   181          ap = ata_shost_to_port(sdev->host);
   182  
   183          spin_lock_irqsave(ap->lock, flags);
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   184          dev = ata_scsi_find_dev(ap, sdev);
   185          if (!dev) {
   186                  rc = -ENODEV;
   187                  goto unlock;
   188          }
   189          if (dev->flags & ATA_DFLAG_NO_UNLOAD) {
   190                  rc = -EOPNOTSUPP;
   191                  goto unlock;
   192          }
   193  
   194          link = dev->link;
   195          now = jiffies;
   196          if (ap->pflags & ATA_PFLAG_EH_IN_PROGRESS &&
   197              link->eh_context.unloaded_mask & (1 << dev->devno) &&
   198              time_after(dev->unpark_deadline, now))
   199                  msecs = jiffies_to_msecs(dev->unpark_deadline - now);
   200          else
   201                  msecs = 0;
   202  
   203  unlock:
   204          spin_unlock_irq(ap->lock);
                ^^^^^^^^^^^^^^^^^^^^^^^^^

This should almost certainly be spin_unlock_irqrestore().

   205  
   206          return rc ? rc : snprintf(buf, 20, "%u\n", msecs);
   207  }


regards,
dan carpenter

             reply	other threads:[~2016-02-17 19:24 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-17 19:24 Dan Carpenter [this message]
2016-02-18  9:45 ` libata: Implement disk shock protection support Elias Oltmanns
2016-02-18 16:54 ` [PATCH libata/for-4.6] libata: fix unbalanced spin_lock_irqsave/spin_unlock_irq() in ata_scsi_park_show() Tejun Heo
2016-02-19  6:49   ` Elias Oltmanns
2016-02-19 16:01     ` Tejun Heo

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=20160217192435.GA14960@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=eo@nebensachen.de \
    --cc=linux-ide@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 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.