On Wed, 2018-08-01 at 11:04 +0300, Avri Altman wrote:
> +     if (qr->opcode != UPIU_QUERY_OPCODE_WRITE_DESC ||
> +         desc_size <= 0)
> +             return -EINVAL;

Please use the full line length and don't split lines if that is not necessary.

> +     ret = ufshcd_map_desc_id_to_length(bsg_host->hba, desc_id, buff_len);
> +
> +     if (ret || !buff_len)
> +             return -EINVAL;

Why is buff_len only tested after it has been passed as an argument to
ufshcd_map_desc_id_to_length()? That seems weird to me.

> +static int ufs_bsg_verify_query_size(unsigned int request_len,
> +                                  unsigned int reply_len,
> +                                  int rw, int buff_len)
> +{
> +     int min_req_len = sizeof(struct ufs_bsg_request);
> +     int min_rsp_len = sizeof(struct ufs_bsg_reply);
> +
> +     if (rw == UFS_BSG_NOP)
> +             goto null_buff;
> +
> +     if (rw == WRITE)
> +             min_req_len += buff_len;

Can the "goto" statement be avoided by using a switch/case on 'rw'?

Thanks,

Bart.

Reply via email to