libata: fix checking of DMA state
authorReimar Döffinger <Reimar.Doeffinger@gmx.de>
Tue, 12 Oct 2021 06:27:44 +0000 (08:27 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 18 Nov 2021 18:16:00 +0000 (19:16 +0100)
commitd5e659a7a6cb3ac4d78ff089d145a345af6d4274
treea9ae9e3d64407be9a5f57986f7ae567758a36e83
parent023d9d9e74d66182733d9e5bc8bf2e4671890110
libata: fix checking of DMA state

commit f971a85439bd25dc7b4d597cf5e4e8dc7ffc884b upstream.

Checking if DMA is enabled should be done via the
ata_dma_enabled helper function, since the init state
0xff indicates disabled.
This meant that ATA_CMD_READ_LOG_DMA_EXT was used and probed
for before DMA was enabled, which caused hangs for some combinations
of controllers and devices.
It might also have caused it to be incorrectly disabled as broken,
but there have been no reports of that.

Cc: stable@vger.kernel.org
BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=195895
Signed-off-by: Reimar Döffinger <Reimar.Doeffinger@gmx.de>
Tested-by: Paul Menzel <pmenzel@molgen.mpg.de>
Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/ata/libata-core.c