diff options
author | Hannes Reinecke <hare@suse.de> | 2014-01-16 05:25:36 -0500 |
---|---|---|
committer | James Bottomley <JBottomley@Parallels.com> | 2014-03-15 13:19:18 -0400 |
commit | 58968fc8fbb3869d9ec84d32b88b58b0423d6793 (patch) | |
tree | 046e98a1e3a46b2ad9be4fd4db4c6266a63868fc /drivers/scsi/megaraid | |
parent | 2f8bdfa84a0b814ef66701be1e5dbc88433676e1 (diff) |
[SCSI] megaraid_sas: check return value for megasas_get_pd_list()
When megasas_get_pd_list() fails we cannot detect any drives,
so we should be checking the return value accordingly.
[jejb: checkpatch fix]
Signed-off-by: Hannes Reinecke <hare@suse.de>
Acked-by: Kashyap Desai <kashyap.desai@lsi.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Diffstat (limited to 'drivers/scsi/megaraid')
-rw-r--r-- | drivers/scsi/megaraid/megaraid_sas_base.c | 38 |
1 files changed, 21 insertions, 17 deletions
diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c index 3b7ad10497fe..f21e48b2e956 100644 --- a/drivers/scsi/megaraid/megaraid_sas_base.c +++ b/drivers/scsi/megaraid/megaraid_sas_base.c | |||
@@ -3763,7 +3763,10 @@ static int megasas_init_fw(struct megasas_instance *instance) | |||
3763 | 3763 | ||
3764 | memset(instance->pd_list, 0 , | 3764 | memset(instance->pd_list, 0 , |
3765 | (MEGASAS_MAX_PD * sizeof(struct megasas_pd_list))); | 3765 | (MEGASAS_MAX_PD * sizeof(struct megasas_pd_list))); |
3766 | megasas_get_pd_list(instance); | 3766 | if (megasas_get_pd_list(instance) < 0) { |
3767 | printk(KERN_ERR "megasas: failed to get PD list\n"); | ||
3768 | goto fail_init_adapter; | ||
3769 | } | ||
3767 | 3770 | ||
3768 | memset(instance->ld_ids, 0xff, MEGASAS_MAX_LD_IDS); | 3771 | memset(instance->ld_ids, 0xff, MEGASAS_MAX_LD_IDS); |
3769 | if (megasas_ld_list_query(instance, | 3772 | if (megasas_ld_list_query(instance, |
@@ -5592,22 +5595,23 @@ megasas_aen_polling(struct work_struct *work) | |||
5592 | 5595 | ||
5593 | if (doscan) { | 5596 | if (doscan) { |
5594 | printk(KERN_INFO "scanning ...\n"); | 5597 | printk(KERN_INFO "scanning ...\n"); |
5595 | megasas_get_pd_list(instance); | 5598 | if (megasas_get_pd_list(instance) == 0) { |
5596 | for (i = 0; i < MEGASAS_MAX_PD_CHANNELS; i++) { | 5599 | for (i = 0; i < MEGASAS_MAX_PD_CHANNELS; i++) { |
5597 | for (j = 0; j < MEGASAS_MAX_DEV_PER_CHANNEL; j++) { | 5600 | for (j = 0; j < MEGASAS_MAX_DEV_PER_CHANNEL; j++) { |
5598 | pd_index = i*MEGASAS_MAX_DEV_PER_CHANNEL + j; | 5601 | pd_index = i*MEGASAS_MAX_DEV_PER_CHANNEL + j; |
5599 | sdev1 = scsi_device_lookup(host, i, j, 0); | 5602 | sdev1 = scsi_device_lookup(host, i, j, 0); |
5600 | if (instance->pd_list[pd_index].driveState == | 5603 | if (instance->pd_list[pd_index].driveState == |
5601 | MR_PD_STATE_SYSTEM) { | 5604 | MR_PD_STATE_SYSTEM) { |
5602 | if (!sdev1) { | 5605 | if (!sdev1) { |
5603 | scsi_add_device(host, i, j, 0); | 5606 | scsi_add_device(host, i, j, 0); |
5604 | } | 5607 | } |
5605 | if (sdev1) | 5608 | if (sdev1) |
5606 | scsi_device_put(sdev1); | 5609 | scsi_device_put(sdev1); |
5607 | } else { | 5610 | } else { |
5608 | if (sdev1) { | 5611 | if (sdev1) { |
5609 | scsi_remove_device(sdev1); | 5612 | scsi_remove_device(sdev1); |
5610 | scsi_device_put(sdev1); | 5613 | scsi_device_put(sdev1); |
5614 | } | ||
5611 | } | 5615 | } |
5612 | } | 5616 | } |
5613 | } | 5617 | } |