* [PATCH 0/2] Fix log page accesses
@ 2021-11-15 6:05 Damien Le Moal
2021-11-15 6:05 ` [PATCH 1/2] libata: core: improve ata_read_log_page() error message Damien Le Moal
2021-11-15 6:05 ` [PATCH 2/2] libata: core: add missing ata_identify_page_supported() calls Damien Le Moal
0 siblings, 2 replies; 3+ messages in thread
From: Damien Le Moal @ 2021-11-15 6:05 UTC (permalink / raw)
To: linux-ide
A couple of patches to improve ata_read_log_page() error message and
to avoid attempts to access non-existent logs.
Damien Le Moal (2):
libata: core: improve ata_read_log_page() error message
libata: core: add missing ata_identify_page_supported() calls
drivers/ata/libata-core.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
--
2.31.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 1/2] libata: core: improve ata_read_log_page() error message
2021-11-15 6:05 [PATCH 0/2] Fix log page accesses Damien Le Moal
@ 2021-11-15 6:05 ` Damien Le Moal
2021-11-15 6:05 ` [PATCH 2/2] libata: core: add missing ata_identify_page_supported() calls Damien Le Moal
1 sibling, 0 replies; 3+ messages in thread
From: Damien Le Moal @ 2021-11-15 6:05 UTC (permalink / raw)
To: linux-ide
If ata_read_log_page() fails to read a log page, the ata_dev_err() error
message only print the page number, omitting the log number. In case of
error, facilitate debugging by also printing the log number.
Cc: stable@kernel.org # 5.15
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
---
drivers/ata/libata-core.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index 8a0ccb190d76..edaedcd82630 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -2031,8 +2031,9 @@ unsigned int ata_read_log_page(struct ata_device *dev, u8 log,
dev->horkage |= ATA_HORKAGE_NO_DMA_LOG;
goto retry;
}
- ata_dev_err(dev, "Read log page 0x%02x failed, Emask 0x%x\n",
- (unsigned int)page, err_mask);
+ ata_dev_err(dev,
+ "Read log 0x%02x page 0x%02x failed, Emask 0x%x\n",
+ (unsigned int)log, (unsigned int)page, err_mask);
}
return err_mask;
--
2.31.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH 2/2] libata: core: add missing ata_identify_page_supported() calls
2021-11-15 6:05 [PATCH 0/2] Fix log page accesses Damien Le Moal
2021-11-15 6:05 ` [PATCH 1/2] libata: core: improve ata_read_log_page() error message Damien Le Moal
@ 2021-11-15 6:05 ` Damien Le Moal
1 sibling, 0 replies; 3+ messages in thread
From: Damien Le Moal @ 2021-11-15 6:05 UTC (permalink / raw)
To: linux-ide
ata_dev_config_ncq_prio() and ata_dev_config_devslp() both access pages
of the IDENTIFY DEVICE data log. Before calling ata_read_log_page(),
make sure to check for the existence of the IDENTIFY DEVICE data log and
of the log page accessed suing ata_identify_page_supported(). This
avoids useless error messages from ata_read_log_page().
Reported-by: Nikolay <knv418@gmail.com>
Cc: stable@kernel.org # 4.14+
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
---
drivers/ata/libata-core.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index edaedcd82630..59ad8c979cb3 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -2178,6 +2178,9 @@ static void ata_dev_config_ncq_prio(struct ata_device *dev)
struct ata_port *ap = dev->link->ap;
unsigned int err_mask;
+ if (!ata_identify_page_supported(dev, ATA_LOG_SATA_SETTINGS))
+ return;
+
err_mask = ata_read_log_page(dev,
ATA_LOG_IDENTIFY_DEVICE,
ATA_LOG_SATA_SETTINGS,
@@ -2454,7 +2457,8 @@ static void ata_dev_config_devslp(struct ata_device *dev)
* Check device sleep capability. Get DevSlp timing variables
* from SATA Settings page of Identify Device Data Log.
*/
- if (!ata_id_has_devslp(dev->id))
+ if (!ata_id_has_devslp(dev->id) ||
+ !ata_identify_page_supported(dev, ATA_LOG_SATA_SETTINGS))
return;
err_mask = ata_read_log_page(dev,
--
2.31.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-11-15 6:06 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-15 6:05 [PATCH 0/2] Fix log page accesses Damien Le Moal
2021-11-15 6:05 ` [PATCH 1/2] libata: core: improve ata_read_log_page() error message Damien Le Moal
2021-11-15 6:05 ` [PATCH 2/2] libata: core: add missing ata_identify_page_supported() calls Damien Le Moal
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).