diff options
Diffstat (limited to 'drivers/scsi/pm8001/pm8001_sas.c')
-rw-r--r-- | drivers/scsi/pm8001/pm8001_sas.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/scsi/pm8001/pm8001_sas.c b/drivers/scsi/pm8001/pm8001_sas.c index be55859042cd..34cea8291772 100644 --- a/drivers/scsi/pm8001/pm8001_sas.c +++ b/drivers/scsi/pm8001/pm8001_sas.c | |||
@@ -77,11 +77,16 @@ inline int pm8001_tag_alloc(struct pm8001_hba_info *pm8001_ha, u32 *tag_out) | |||
77 | { | 77 | { |
78 | unsigned int tag; | 78 | unsigned int tag; |
79 | void *bitmap = pm8001_ha->tags; | 79 | void *bitmap = pm8001_ha->tags; |
80 | unsigned long flags; | ||
80 | 81 | ||
82 | spin_lock_irqsave(&pm8001_ha->bitmap_lock, flags); | ||
81 | tag = find_first_zero_bit(bitmap, pm8001_ha->tags_num); | 83 | tag = find_first_zero_bit(bitmap, pm8001_ha->tags_num); |
82 | if (tag >= pm8001_ha->tags_num) | 84 | if (tag >= pm8001_ha->tags_num) { |
85 | spin_unlock_irqrestore(&pm8001_ha->bitmap_lock, flags); | ||
83 | return -SAS_QUEUE_FULL; | 86 | return -SAS_QUEUE_FULL; |
87 | } | ||
84 | set_bit(tag, bitmap); | 88 | set_bit(tag, bitmap); |
89 | spin_unlock_irqrestore(&pm8001_ha->bitmap_lock, flags); | ||
85 | *tag_out = tag; | 90 | *tag_out = tag; |
86 | return 0; | 91 | return 0; |
87 | } | 92 | } |