@@ -787,8 +787,7 @@ int ata_build_rw_tf(struct ata_taskfile *tf, struct ata_device *dev,
if (tf->flags & ATA_TFLAG_FUA)
tf->device |= 1 << 7;
- if ((dev->flags & ATA_DFLAG_NCQ_PRIO) &&
- (dev->flags & ATA_DFLAG_NCQ_PRIO_ENABLE)) {
+ if (dev->flags & ATA_DFLAG_NCQ_PRIO_ENABLE) {
if (class == IOPRIO_CLASS_RT)
tf->hob_nsect |= ATA_PRIO_HIGH <<
ATA_SHIFT_PRIO;
@@ -323,10 +323,16 @@ static ssize_t ata_ncq_prio_enable_store(struct device *device,
goto unlock;
}
- if (input)
+ if (input) {
+ if (!(dev->flags & ATA_DFLAG_NCQ_PRIO)) {
+ rc = -EOPNOTSUPP;
+ goto unlock;
+ }
+
dev->flags |= ATA_DFLAG_NCQ_PRIO_ENABLE;
- else
+ } else {
dev->flags &= ~ATA_DFLAG_NCQ_PRIO_ENABLE;
+ }
unlock:
spin_unlock_irqrestore(ap->lock, flags);