scsi: megaraid_sas: Indentation and smatch warning fixes

Fix indentation issues and smatch warning reported by Dan Carpenter
for previous series as discussed below.
http://www.spinics.net/lists/linux-scsi/msg103635.html
http://www.spinics.net/lists/linux-scsi/msg103603.html

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Kashyap Desai <kashyap.desai@broadcom.com>
Signed-off-by: Sasikumar Chandrasekaran <sasikumar.pc@broadcom.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
This commit is contained in:
Shivasharan S 2017-02-10 00:59:37 -08:00 committed by Martin K. Petersen
parent e00731bc5a
commit 41064f1bf8
5 changed files with 80 additions and 83 deletions

View File

@ -5343,7 +5343,7 @@ static int megasas_init_fw(struct megasas_instance *instance)
memset(instance->ld_ids, 0xff, MEGASAS_MAX_LD_IDS); memset(instance->ld_ids, 0xff, MEGASAS_MAX_LD_IDS);
/* stream detection initialization */ /* stream detection initialization */
if (instance->is_ventura) { if (instance->is_ventura && fusion) {
fusion->stream_detect_by_ld = fusion->stream_detect_by_ld =
kzalloc(sizeof(struct LD_STREAM_DETECT *) kzalloc(sizeof(struct LD_STREAM_DETECT *)
* MAX_LOGICAL_DRIVES_EXT, * MAX_LOGICAL_DRIVES_EXT,

View File

@ -243,15 +243,18 @@ void MR_PopulateDrvRaidMap(struct megasas_instance *instance)
(raid_map_data + le32_to_cpu(desc_table->raid_map_desc_offset)); (raid_map_data + le32_to_cpu(desc_table->raid_map_desc_offset));
memcpy(pDrvRaidMap->arMapInfo, memcpy(pDrvRaidMap->arMapInfo,
fw_map_dyn->ar_map_info, fw_map_dyn->ar_map_info,
sizeof(struct MR_ARRAY_INFO) * le32_to_cpu(desc_table->raid_map_desc_elements)); sizeof(struct MR_ARRAY_INFO) *
le32_to_cpu(desc_table->raid_map_desc_elements));
break; break;
case RAID_MAP_DESC_TYPE_SPAN_INFO: case RAID_MAP_DESC_TYPE_SPAN_INFO:
fw_map_dyn->ld_span_map = fw_map_dyn->ld_span_map =
(struct MR_LD_SPAN_MAP *) (struct MR_LD_SPAN_MAP *)
(raid_map_data + le32_to_cpu(desc_table->raid_map_desc_offset)); (raid_map_data +
le32_to_cpu(desc_table->raid_map_desc_offset));
memcpy(pDrvRaidMap->ldSpanMap, memcpy(pDrvRaidMap->ldSpanMap,
fw_map_dyn->ld_span_map, fw_map_dyn->ld_span_map,
sizeof(struct MR_LD_SPAN_MAP) * le32_to_cpu(desc_table->raid_map_desc_elements)); sizeof(struct MR_LD_SPAN_MAP) *
le32_to_cpu(desc_table->raid_map_desc_elements));
break; break;
default: default:
dev_dbg(&instance->pdev->dev, "wrong number of desctableElements %d\n", dev_dbg(&instance->pdev->dev, "wrong number of desctableElements %d\n",

View File

@ -446,8 +446,6 @@ megasas_alloc_cmdlist_fusion(struct megasas_instance *instance)
return -ENOMEM; return -ENOMEM;
} }
for (i = 0; i < max_mpt_cmd; i++) { for (i = 0; i < max_mpt_cmd; i++) {
fusion->cmd_list[i] = kzalloc(sizeof(struct megasas_cmd_fusion), fusion->cmd_list[i] = kzalloc(sizeof(struct megasas_cmd_fusion),
GFP_KERNEL); GFP_KERNEL);
@ -2048,8 +2046,8 @@ static void megasas_stream_detect(struct megasas_instance *instance,
struct STREAM_DETECT *current_sd; struct STREAM_DETECT *current_sd;
/* find possible stream */ /* find possible stream */
for (i = 0; i < MAX_STREAMS_TRACKED; ++i) { for (i = 0; i < MAX_STREAMS_TRACKED; ++i) {
stream_num = stream_num = (*track_stream >>
(*track_stream >> (i * BITS_PER_INDEX_STREAM)) & (i * BITS_PER_INDEX_STREAM)) &
STREAM_MASK; STREAM_MASK;
current_sd = &current_ld_sd->stream_track[stream_num]; current_sd = &current_ld_sd->stream_track[stream_num];
/* if we found a stream, update the raid /* if we found a stream, update the raid
@ -2061,8 +2059,8 @@ static void megasas_stream_detect(struct megasas_instance *instance,
(io_info->ldStartBlock <= (current_sd->next_seq_lba + 32)) && (io_info->ldStartBlock <= (current_sd->next_seq_lba + 32)) &&
(current_sd->is_read == io_info->isRead)) { (current_sd->is_read == io_info->isRead)) {
if ((io_info->ldStartBlock != current_sd->next_seq_lba) if ((io_info->ldStartBlock != current_sd->next_seq_lba) &&
&& ((!io_info->isRead) || (!is_read_ahead))) ((!io_info->isRead) || (!is_read_ahead)))
/* /*
* Once the API availible we need to change this. * Once the API availible we need to change this.
* At this point we are not allowing any gap * At this point we are not allowing any gap
@ -2087,24 +2085,20 @@ static void megasas_stream_detect(struct megasas_instance *instance,
*track_stream = *track_stream =
unshifted_values | shifted_values | stream_num; unshifted_values | shifted_values | stream_num;
return; return;
} }
} }
/* /*
* if we did not find any stream, create a new one * if we did not find any stream, create a new one
* from the least recently used * from the least recently used
*/ */
stream_num = stream_num = (*track_stream >>
(*track_stream >> ((MAX_STREAMS_TRACKED - 1) * BITS_PER_INDEX_STREAM)) & ((MAX_STREAMS_TRACKED - 1) * BITS_PER_INDEX_STREAM)) &
STREAM_MASK; STREAM_MASK;
current_sd = &current_ld_sd->stream_track[stream_num]; current_sd = &current_ld_sd->stream_track[stream_num];
current_sd->is_read = io_info->isRead; current_sd->is_read = io_info->isRead;
current_sd->next_seq_lba = io_info->ldStartBlock + io_info->numBlocks; current_sd->next_seq_lba = io_info->ldStartBlock + io_info->numBlocks;
*track_stream = *track_stream = (((*track_stream & ZERO_LAST_STREAM) << 4) | stream_num);
(((*track_stream & ZERO_LAST_STREAM) << 4) | stream_num);
return; return;
} }
/** /**