diff mbox series

[1/5] scsi: megaraid_sas: correct the parameter of scsi_device_lookup

Message ID 1663145283-4872-2-git-send-email-kanie@linux.alibaba.com
State New
Headers show
Series scsi: megaraid_sas: some bug fixes and cod cleanup | expand

Commit Message

Guixin Liu Sept. 14, 2022, 8:47 a.m. UTC
When a delete event is received, find the scsi_device and remove it,
the scsi_device_lookup`s parameter id should be "ld_target_id %
MEGASAS_MAX_DEV_PER_CHANNEL".

Fixes: ae6874ba4b43 ("scsi: megaraid_sas: Early detection of VD deletion through RaidMap update")
Signed-off-by: Guixin Liu <kanie@linux.alibaba.com>

---
 drivers/scsi/megaraid/megaraid_sas_base.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Sumit Saxena Sept. 28, 2022, 10:50 a.m. UTC | #1
On Wed, Sep 14, 2022 at 2:18 PM Guixin Liu <kanie@linux.alibaba.com> wrote:
>
> When a delete event is received, find the scsi_device and remove it,
> the scsi_device_lookup`s parameter id should be "ld_target_id %
> MEGASAS_MAX_DEV_PER_CHANNEL".
>
> Fixes: ae6874ba4b43 ("scsi: megaraid_sas: Early detection of VD deletion through RaidMap update")
> Signed-off-by: Guixin Liu <kanie@linux.alibaba.com>

Looks good to me.
Acked-by: Sumit Saxena <sumit.saxena@broadcom.com>
diff mbox series

Patch

diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c
index 7f8632c..44d5e93 100644
--- a/drivers/scsi/megaraid/megaraid_sas_base.c
+++ b/drivers/scsi/megaraid/megaraid_sas_base.c
@@ -8922,7 +8922,7 @@  void megasas_add_remove_devices(struct megasas_instance *instance,
 			sdev1 = scsi_device_lookup(instance->host,
 						   MEGASAS_MAX_PD_CHANNELS +
 						   (ld_target_id / MEGASAS_MAX_DEV_PER_CHANNEL),
-						   (ld_target_id - MEGASAS_MAX_DEV_PER_CHANNEL),
+						   (ld_target_id % MEGASAS_MAX_DEV_PER_CHANNEL),
 						   0);
 			dev_info(&instance->pdev->dev, "Debug_lgx: ld_target_id:%u, sdev1:%p.\n",
                                ld_target_id, sdev1);