]> www.infradead.org Git - users/jedix/linux-maple.git/commit
ata: libata: Improve __ata_qc_complete()
authorDamien Le Moal <dlemoal@kernel.org>
Tue, 25 Jun 2024 12:07:32 +0000 (21:07 +0900)
committerDamien Le Moal <dlemoal@kernel.org>
Sat, 7 Sep 2024 01:16:55 +0000 (10:16 +0900)
commit5bb52d926598a018b1510fd6684dcbaed31d57f2
tree4848941543bc90b6aa2052f76bb1d305a3bfd155
parenta16951510fae8fa9b934673404c4fc990d124ccd
ata: libata: Improve __ata_qc_complete()

The function __ata_qc_complete() is always called with a qc that already
has been dereferenced and so is guaranteed to be non-NULL (as otherwise
the kernel would have crashed). So remove the warning for a NULL qc as
it is useless.

Furthermore, the qc passed to __ata_qc_complete() must always be marked
as active with the ATA_QCFLAG_ACTIVE flag. If that is not the case, in
addition to the existing warning, return early so that we do not attempt
to complete an invalid qc.

Finally, fix the comment related to clearing the qc active flag as that
operation applies to all devices, not just ATAPI ones.

Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
Reviewed-by: Niklas Cassel <cassel@kernel.org>
Reviewed-by: Hannes Reinecke <hare@suse.de>
drivers/ata/libata-core.c