diff options
author | Damien Le Moal <dlemoal@kernel.org> | 2025-07-01 21:53:16 +0900 |
---|---|---|
committer | Niklas Cassel <cassel@kernel.org> | 2025-07-02 12:01:33 +0200 |
commit | 413e800cadbf67550d76c77c230b2ecd96bce83a (patch) | |
tree | d9764462f8b5df6ac5c329d5a53162e1d4dc0156 | |
parent | 4371fe1ba40065c5e1dd6e8317f9df8ba50a3db7 (diff) |
ata: libata-sata: Disallow changing LPM state if not supported
Modify ata_scsi_lpm_store() to return an error if a user attempts to set
a link power management policy for a port that does not support LPM,
that is, ports flagged with ATA_FLAG_NO_LPM.
Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
Reviewed-by: Niklas Cassel <cassel@kernel.org>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Link: https://lore.kernel.org/r/20250701125321.69496-6-dlemoal@kernel.org
Signed-off-by: Niklas Cassel <cassel@kernel.org>
-rw-r--r-- | drivers/ata/libata-sata.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/ata/libata-sata.c b/drivers/ata/libata-sata.c index cb46ce276bb1..47169c469f43 100644 --- a/drivers/ata/libata-sata.c +++ b/drivers/ata/libata-sata.c @@ -924,6 +924,11 @@ static ssize_t ata_scsi_lpm_store(struct device *device, spin_lock_irqsave(ap->lock, flags); + if (ap->flags & ATA_FLAG_NO_LPM) { + count = -EOPNOTSUPP; + goto out_unlock; + } + ata_for_each_link(link, ap, EDGE) { ata_for_each_dev(dev, &ap->link, ENABLED) { if (dev->quirks & ATA_QUIRK_NOLPM) { |