mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: <shao.mingyin@zte.com.cn>
To: <linux-ide@vger.kernel.org>, <dlemoal@kernel.org>, <cassel@kernel.org>
Cc: <linux-kernel@vger.kernel.org>, <yang.tao172@zte.com.cn>,
	<zhang.yue5@zte.com.cn>
Subject: [PATCH] ata: libata-eh: drop redundant ata_tag_valid() check in ata_eh_maybe_retry_flush()
Date: Tue, 20 Oct 2026 16:01:01 +0800 (CST)	[thread overview]
Message-ID: <20261020160101007xAtLUWDrReLsKCbDsa5eu@zte.com.cn> (raw)

From: Shao Mingyin <shao.mingyin@zte.com.cn>

ata_eh_maybe_retry_flush() validates link->active_tag with ata_tag_valid()
before calling __ata_qc_from_tag(), which itself evaluates ata_tag_valid()
on the same tag and returns NULL when the tag is invalid.

Since the NULL return value of __ata_qc_from_tag() is the single source of
truth for tag validity, drop the redundant explicit ata_tag_valid() check
and simply return early when qc is NULL.  This mirrors the style already
used in ata_eh_get_non_ncq_success_sense().

No functional change.

Signed-off-by: Shao Mingyin <shao.mingyin@zte.com.cn>
Signed-off-by: Yang Tao <yang.tao172@zte.com.cn>
---
 drivers/ata/libata-eh.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c
index c93c24b22d9c..bf3313175a97 100644
--- a/drivers/ata/libata-eh.c
+++ b/drivers/ata/libata-eh.c
@@ -3571,11 +3571,9 @@ static int ata_eh_maybe_retry_flush(struct ata_device *dev)
 	unsigned int err_mask;
 	int rc = 0;

-	/* did flush fail for this device? */
-	if (!ata_tag_valid(link->active_tag))
-		return 0;
-
 	qc = __ata_qc_from_tag(ap, link->active_tag);
+	if (!qc)
+		return 0;
 	if (qc->dev != dev || (qc->tf.command != ATA_CMD_FLUSH_EXT &&
 			       qc->tf.command != ATA_CMD_FLUSH))
 		return 0;
-- 
2.27.0

                 reply	other threads:[~2026-10-20  8:01 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261020160101007xAtLUWDrReLsKCbDsa5eu@zte.com.cn \
    --to=shao.mingyin@zte.com.cn \
    --cc=cassel@kernel.org \
    --cc=dlemoal@kernel.org \
    --cc=linux-ide@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=yang.tao172@zte.com.cn \
    --cc=zhang.yue5@zte.com.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®