aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata/libata-core.c
diff options
context:
space:
mode:
authorHannes Reinecke <hare@suse.de>2016-04-25 06:45:48 -0400
committerTejun Heo <tj@kernel.org>2016-05-09 12:36:45 -0400
commitfe5af0cc3029d52e31d282f5d53787d308e9695a (patch)
treead819b31fe6a124e3022d28ac915a63263db2f7e /drivers/ata/libata-core.c
parent5c65d8bb3503beb12864895426a69269c19e6e87 (diff)
libata: Check log page directory before accessing pages
When reading the NCQ Send/Recv log it might actually not supported, thereby causing irritating messages 'READ LOG DMA EXT failed'. Instead we should be reading the log directory first to figure out if the log is actually supported before trying to access it. Signed-off-by: Hannes Reinecke <hare@suse.com> Signed-off-by: Tejun Heo <tj@kernel.org>
Diffstat (limited to 'drivers/ata/libata-core.c')
-rw-r--r--drivers/ata/libata-core.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index fa74b57ee52e..b2bd7c499653 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -66,6 +66,7 @@
66#include <scsi/scsi_host.h> 66#include <scsi/scsi_host.h>
67#include <linux/libata.h> 67#include <linux/libata.h>
68#include <asm/byteorder.h> 68#include <asm/byteorder.h>
69#include <asm/unaligned.h>
69#include <linux/cdrom.h> 70#include <linux/cdrom.h>
70#include <linux/ratelimit.h> 71#include <linux/ratelimit.h>
71#include <linux/pm_runtime.h> 72#include <linux/pm_runtime.h>
@@ -2083,7 +2084,23 @@ static void ata_dev_config_ncq_send_recv(struct ata_device *dev)
2083{ 2084{
2084 struct ata_port *ap = dev->link->ap; 2085 struct ata_port *ap = dev->link->ap;
2085 unsigned int err_mask; 2086 unsigned int err_mask;
2087 int log_index = ATA_LOG_NCQ_SEND_RECV * 2;
2088 u16 log_pages;
2086 2089
2090 err_mask = ata_read_log_page(dev, ATA_LOG_DIRECTORY,
2091 0, ap->sector_buf, 1);
2092 if (err_mask) {
2093 ata_dev_dbg(dev,
2094 "failed to get Log Directory Emask 0x%x\n",
2095 err_mask);
2096 return;
2097 }
2098 log_pages = get_unaligned_le16(&ap->sector_buf[log_index]);
2099 if (!log_pages) {
2100 ata_dev_warn(dev,
2101 "NCQ Send/Recv Log not supported\n");
2102 return;
2103 }
2087 err_mask = ata_read_log_page(dev, ATA_LOG_NCQ_SEND_RECV, 2104 err_mask = ata_read_log_page(dev, ATA_LOG_NCQ_SEND_RECV,
2088 0, ap->sector_buf, 1); 2105 0, ap->sector_buf, 1);
2089 if (err_mask) { 2106 if (err_mask) {