ata: libata-core: Do not try to set sleeping devices to standby
authorDamien Le Moal <dlemoal@kernel.org>
Thu, 11 Jan 2024 11:51:22 +0000 (20:51 +0900)
committerNiklas Cassel <cassel@kernel.org>
Wed, 14 Feb 2024 10:02:08 +0000 (11:02 +0100)
In ata ata_dev_power_set_standby(), check that the target device is not
sleeping. If it is, there is no need to do anything.

Fixes: aa3998dbeb3a ("ata: libata-scsi: Disable scsi device manage_system_start_stop")
Cc: stable@vger.kernel.org
Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
Signed-off-by: Niklas Cassel <cassel@kernel.org>
drivers/ata/libata-core.c

index 09ed67772fae492323361ab7e94f8a8d4345d2e8..d9f80f4f70f5b29ae15693fc5ae5e14a8ffcdfb4 100644 (file)
@@ -2017,6 +2017,10 @@ void ata_dev_power_set_standby(struct ata_device *dev)
        struct ata_taskfile tf;
        unsigned int err_mask;
 
+       /* If the device is already sleeping, do nothing. */
+       if (dev->flags & ATA_DFLAG_SLEEPING)
+               return;
+
        /*
         * Some odd clown BIOSes issue spindown on power off (ACPI S4 or S5)
         * causing some drives to spin up and down again. For these, do nothing