From: Elias Oltmanns <eo@nebensachen.de>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: linux-ide@vger.kernel.org,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Subject: Re: libata: Implement disk shock protection support
Date: Thu, 18 Feb 2016 10:45:59 +0100 [thread overview]
Message-ID: <8760xmic6g.fsf@denkblock.local> (raw)
In-Reply-To: 20160217192435.GA14960@mwanda
Hi Dan,
On 17 February 2016 at 20:24 CET, Dan Carpenter wrote:
> 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 {
[...]
> 183 spin_lock_irqsave(ap->lock, flags);
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[...]
> 204 spin_unlock_irq(ap->lock);
> ^^^^^^^^^^^^^^^^^^^^^^^^^
>
> This should almost certainly be spin_unlock_irqrestore().
since this is an accessor function for a sysfs attribute (see:
DEVICE_ATTR(unload_heads, S_IRUGO | S_IWUSR,
ata_scsi_park_show, ata_scsi_park_store);
at line 269), it will only ever be called from process context, in my
estimation. So, I suggest using spin_lock_irq() rather than the
_irqsave() variant. The same goes for the ata_scsi_park_store()
function.
Thanks for pointing out the inconsistency. Even though the patch itself
is quite straight forward, I won't have time to even compile test it
before the weekend.
Regards,
Elias
next prev parent reply other threads:[~2016-02-18 9:53 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-17 19:24 libata: Implement disk shock protection support Dan Carpenter
2016-02-18 9:45 ` Elias Oltmanns [this message]
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=8760xmic6g.fsf@denkblock.local \
--to=eo@nebensachen.de \
--cc=dan.carpenter@oracle.com \
--cc=gregkh@linuxfoundation.org \
--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.