From c2cdef95160440ed6291bc343139d958ba3261e4 Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Mon, 25 Jun 2018 08:05:16 -0700 Subject: scsi: qedi: Fix misleading indentation This patch avoids that smatch reports the following warnings: drivers/scsi/qedi/qedi_fw_api.c:129: init_sqe() warn: inconsistent indenting drivers/scsi/qedi/qedi_fw_api.c:137: init_sqe() warn: inconsistent indenting Signed-off-by: Bart Van Assche Cc: QLogic-Storage-Upstream@cavium.com Reviewed-by: Johannes Thumshirn Signed-off-by: Martin K. Petersen --- drivers/scsi/qedi/qedi_fw_api.c | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) (limited to 'drivers/scsi/qedi') diff --git a/drivers/scsi/qedi/qedi_fw_api.c b/drivers/scsi/qedi/qedi_fw_api.c index a269da1a6c75..387dc87e4d22 100644 --- a/drivers/scsi/qedi/qedi_fw_api.c +++ b/drivers/scsi/qedi/qedi_fw_api.c @@ -126,22 +126,24 @@ static void init_sqe(struct iscsi_task_params *task_params, sgl_task_params, dif_task_params); - if (scsi_is_slow_sgl(sgl_task_params->num_sges, - sgl_task_params->small_mid_sge)) - num_sges = ISCSI_WQE_NUM_SGES_SLOWIO; - else - num_sges = min(sgl_task_params->num_sges, - (u16)SCSI_NUM_SGES_SLOW_SGL_THR); - } + if (scsi_is_slow_sgl(sgl_task_params->num_sges, + sgl_task_params->small_mid_sge)) + num_sges = ISCSI_WQE_NUM_SGES_SLOWIO; + else + num_sges = min(sgl_task_params->num_sges, + (u16)SCSI_NUM_SGES_SLOW_SGL_THR); + } - SET_FIELD(task_params->sqe->flags, ISCSI_WQE_NUM_SGES, num_sges); - SET_FIELD(task_params->sqe->contlen_cdbsize, ISCSI_WQE_CONT_LEN, - buf_size); + SET_FIELD(task_params->sqe->flags, ISCSI_WQE_NUM_SGES, + num_sges); + SET_FIELD(task_params->sqe->contlen_cdbsize, ISCSI_WQE_CONT_LEN, + buf_size); - if (GET_FIELD(pdu_header->hdr_second_dword, - ISCSI_CMD_HDR_TOTAL_AHS_LEN)) - SET_FIELD(task_params->sqe->contlen_cdbsize, ISCSI_WQE_CDB_SIZE, - cmd_params->extended_cdb_sge.sge_len); + if (GET_FIELD(pdu_header->hdr_second_dword, + ISCSI_CMD_HDR_TOTAL_AHS_LEN)) + SET_FIELD(task_params->sqe->contlen_cdbsize, + ISCSI_WQE_CDB_SIZE, + cmd_params->extended_cdb_sge.sge_len); } break; case ISCSI_TASK_TYPE_INITIATOR_READ: -- cgit v1.2.1 From 915d9b71422126076f1971f1a44561ae76890060 Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Thu, 28 Jun 2018 12:23:10 +0300 Subject: scsi: qedi: tidy up a size calculation The id_tbl->table pointer points to unsigned long so static checkers complain that instead of 4 we should be allocating sizeof(long) bytes. We're trying to allocate enough bits for the bitmap. The size variable is always 1024. (1024 / 32 * 4) is the same as (1024 / 64 * 8) so this doesn't change runtime, but this is the more idiomatic way to do it and makes the static checker happy. [mkp: typo] Signed-off-by: Dan Carpenter Acked-by: Manish Rangankar Signed-off-by: Martin K. Petersen --- drivers/scsi/qedi/qedi_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/scsi/qedi') diff --git a/drivers/scsi/qedi/qedi_main.c b/drivers/scsi/qedi/qedi_main.c index cf274a79e77a..682f3ce31014 100644 --- a/drivers/scsi/qedi/qedi_main.c +++ b/drivers/scsi/qedi/qedi_main.c @@ -524,7 +524,7 @@ static int qedi_init_id_tbl(struct qedi_portid_tbl *id_tbl, u16 size, id_tbl->max = size; id_tbl->next = next; spin_lock_init(&id_tbl->lock); - id_tbl->table = kcalloc(DIV_ROUND_UP(size, 32), 4, GFP_KERNEL); + id_tbl->table = kcalloc(BITS_TO_LONGS(size), sizeof(long), GFP_KERNEL); if (!id_tbl->table) return -ENOMEM; -- cgit v1.2.1