From: Igor Pylypiv Date: Thu, 2 Apr 2026 16:07:05 +0000 (-0700) Subject: ata: libata-eh: Do not retry reset if the device is gone X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=182caa17360dd48e6df08e18f00ebda0be87ab24;p=thirdparty%2Flinux.git ata: libata-eh: Do not retry reset if the device is gone If a device is hot-unplugged or otherwise disappears during error handling, ata_eh_reset() may fail with -ENODEV. Currently, the error handler will continue to retry the reset operation up to max_tries times. Prevent unnecessary reset retries by exiting the loop early when ata_do_reset() returns -ENODEV. Reviewed-by: Damien Le Moal Signed-off-by: Igor Pylypiv Signed-off-by: Niklas Cassel --- diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c index bb0813ea8b180..9a4b67b90b17b 100644 --- a/drivers/ata/libata-eh.c +++ b/drivers/ata/libata-eh.c @@ -3181,7 +3181,7 @@ int ata_eh_reset(struct ata_link *link, int classify, sata_scr_read(link, SCR_STATUS, &sstatus)) rc = -ERESTART; - if (try >= max_tries) { + if (try >= max_tries || rc == -ENODEV) { /* * Thaw host port even if reset failed, so that the port * can be retried on the next phy event. This risks