Re: [PATCH v2 6/6] qla2xxx: Refactor usage of Active command arrays

Bart Van Assche
2017-07-21T23:12:45Z

On Fri, 2017-07-21 at 09:32 -0700, Himanshu Madhani wrote:
> From: Quinn Tran <quinn.tran@cavium.com>

Thank you for having done this work!

> +#define SRB_TO_U(_p) container_of(_p, struct unify_cmd, srb)
> +#define TCMD_TO_U(_p) container_of(_p, struct unify_cmd, tcmd)

If you have to repost this patch, please change these macros into inline
functions such that the compiler can check the type of the argument (_p).

> @@ -2799,7 +2800,7 @@ qla2x00_alloc_outstanding_cmds(struct qla_hw_data *ha, struct req_que *req)
> req->num_outstanding_cmds = ha->cur_fw_iocb_count;
> }
>
> - req->outstanding_cmds = kzalloc(sizeof(srb_t *) *
> + req->outstanding_cmds = kzalloc(sizeof(struct unify_cmd *) *
> req->num_outstanding_cmds, GFP_KERNEL);
>
> if (!req->outstanding_cmds) {
> @@ -2808,7 +2809,7 @@ qla2x00_alloc_outstanding_cmds(struct qla_hw_data *ha, struct req_que *req)
> * initialization.
> */
> req->num_outstanding_cmds = MIN_OUTSTANDING_COMMANDS;
> - req->outstanding_cmds = kzalloc(sizeof(srb_t *) *
> + req->outstanding_cmds = kzalloc(sizeof(struct unify_cmd *) *
> req->num_outstanding_cmds, GFP_KERNEL);
>
> if (!req->outstanding_cmds) {

Please use kcalloc() instead of kzalloc(... * ..., ...).

> @@ -2165,6 +2170,7 @@ qla25xx_process_bidir_status_iocb(scsi_qla_host_t *vha, void *pkt,
> struct fc_bsg_reply *bsg_reply;
> sts_entry_t *sts;
> struct sts_entry_24xx *sts24;
> + struct unify_cmd *u;
> sts = (sts_entry_t *) pkt;
> sts24 = (struct sts_entry_24xx *) pkt;

Please leave a blank line between declarations and code.

Anyway, whether or not these comments get addressed:

Reviewed-by: Bart Van Assche <bart.vanassche@wdc.com>