diff mbox

[09/10] libata-scsi: Fix ZBC management out command translation

Message ID 1468454751-12466-10-git-send-email-hch@lst.de
State Not Applicable
Delegated to: David Miller
Headers show

Commit Message

Christoph Hellwig July 14, 2016, 12:05 a.m. UTC
From: Damien Le Moal <damien.lemoal@hgst.com>

The subcommand for NCQ NON-DATA must be specified in the feature
(low byte), not the high-order count byte.  Also make sure to properly
cast the all bit to a u16 before shiting it by 8 to avoid undefined
behavior.

Signed-off-by: Damien Le Moal <damien.lemoal@hgst.com>
[hch: split the original patch into two, updated changelog]
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 drivers/ata/libata-scsi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Sergei Shtylyov July 14, 2016, 11:54 a.m. UTC | #1
On 7/14/2016 3:05 AM, Christoph Hellwig wrote:

> From: Damien Le Moal <damien.lemoal@hgst.com>
>
> The subcommand for NCQ NON-DATA must be specified in the feature
> (low byte), not the high-order count byte.  Also make sure to properly
> cast the all bit to a u16 before shiting it by 8 to avoid undefined

    Shifting. :-)

> behavior.
>
> Signed-off-by: Damien Le Moal <damien.lemoal@hgst.com>
> [hch: split the original patch into two, updated changelog]
> Signed-off-by: Christoph Hellwig <hch@lst.de>
[...]

MBR, Sergei

--
To unsubscribe from this list: send the line "unsubscribe linux-ide" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index 45d8ae63..d978153 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -3553,9 +3553,9 @@  static unsigned int ata_scsi_zbc_out_xlat(struct ata_queued_cmd *qc)
 	    ata_fpdma_zac_mgmt_out_supported(qc->dev)) {
 		tf->protocol = ATA_PROT_NCQ_NODATA;
 		tf->command = ATA_CMD_NCQ_NON_DATA;
-		tf->hob_nsect = ATA_SUBCMD_NCQ_NON_DATA_ZAC_MGMT_OUT;
+		tf->feature = ATA_SUBCMD_NCQ_NON_DATA_ZAC_MGMT_OUT;
 		tf->nsect = qc->tag << 3;
-		tf->auxiliary = sa | (reset_all & 0x1) << 8;
+		tf->auxiliary = sa | ((u16)(reset_all & 0x1) << 8);
 	} else {
 		tf->protocol = ATA_PROT_NODATA;
 		tf->command = ATA_CMD_ZAC_MGMT_OUT;