2020-04-03 16:07:40

by Jules Irenge

[permalink] [raw]
Subject: [PATCH 4/5] libata: Add missing annotation for ata_scsi_rbuf_get() and ata_scsi_rbuf_fill()

Sparse reports a warning at ata_scsi_rbuf_fill() and ata_scsi_rbuf_get()

warning: context imbalance in ata_scsi_rbuf_get() - wrong count at exit
warning: context imbalance in ata_scsi_rbuf_fill() - unexpected unlock

The root cause is the missing annotation at ata_scsi_rbuf_fill()
and ata_scsi_rbuf_get()

Add the missing __acquires(&ata_scsi_rbuf_lock)
Add the missing __releases(&ata_scsi_rbuf_lock)

Signed-off-by: Jules Irenge <[email protected]>
---
drivers/ata/libata-scsi.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index eb2eb599e602..3436b782053d 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -2082,6 +2082,7 @@ struct ata_scsi_args {
*/
static void *ata_scsi_rbuf_get(struct scsi_cmnd *cmd, bool copy_in,
unsigned long *flags)
+ __acquires(&ata_scsi_rbuf_lock)
{
spin_lock_irqsave(&ata_scsi_rbuf_lock, *flags);

@@ -2106,6 +2107,7 @@ static void *ata_scsi_rbuf_get(struct scsi_cmnd *cmd, bool copy_in,
*/
static inline void ata_scsi_rbuf_put(struct scsi_cmnd *cmd, bool copy_out,
unsigned long *flags)
+ __releases(&ata_scsi_rbuf_lock)
{
if (copy_out)
sg_copy_from_buffer(scsi_sglist(cmd), scsi_sg_count(cmd),
--
2.24.1