scsi: megaraid_sas: Fix calculation of target ID
authorShivasharan S <shivasharan.srikanteshwara@broadcom.com>
Sat, 29 Jun 2019 01:02:12 +0000 (18:02 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 31 Jul 2019 05:28:35 +0000 (07:28 +0200)
commitddb96c6435b5a0744b65e089e5ca8db43051aae9
treecca0db9e72e4808445ab2f498a9358a93c00ec40
parent2d33fd9aac31cb0d8f3e23ac709e48377eedc7ac
scsi: megaraid_sas: Fix calculation of target ID

commit c8f96df5b8e633056b7ebf5d52a9d6fb1b156ce3 upstream.

In megasas_get_target_prop(), driver is incorrectly calculating the target
ID for devices with channel 1 and 3.  Due to this, firmware will either
fail the command (if there is no device with the target id sent from
driver) or could return the properties for a target which was not
intended.  Devices could end up with the wrong queue depth due to this.

Fix target id calculation for channel 1 and 3.

Fixes: 96188a89cc6d ("scsi: megaraid_sas: NVME interface target prop added")
Cc: stable@vger.kernel.org
Signed-off-by: Shivasharan S <shivasharan.srikanteshwara@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/scsi/megaraid/megaraid_sas_base.c