RE: [<RFC PATCH v1> 1/2] scsi: ufs: add write booster feature support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




> +       /* Enable WB only for UFS-3.1 OR if desc len >= 0x59 */
You don't really check that the descriptor size is large enough

> +       if (dev_info->wspecversion >= 0x310) {
> +               hba->dev_info.d_ext_ufs_feature_sup =
> +                       desc_buf[DEVICE_DESC_PARAM_EXT_UFS_FEATURE_SUP]
> +                                                               << 24 |
> +                       desc_buf[DEVICE_DESC_PARAM_EXT_UFS_FEATURE_SUP + 1]
> +                                                               << 16 |
> +                       desc_buf[DEVICE_DESC_PARAM_EXT_UFS_FEATURE_SUP + 2]
> +                                                               << 8 |
> +                       desc_buf[DEVICE_DESC_PARAM_EXT_UFS_FEATURE_SUP + 3];
> +
> +               hba->dev_info.b_wb_buffer_type =
> +                       desc_buf[DEVICE_DESC_PARAM_WB_TYPE];
> +
> +               if (hba->dev_info.b_wb_buffer_type)
> +                       goto skip_unit_desc;
> +
> +               hba->dev_info.wb_config_lun = false;
> +               for (lun = 0; lun < UFS_UPIU_MAX_GENERAL_LUN; lun++) {
You forgot to set 
u8 wb_buf[4] = {};

> +                       memset(wb_buf, 0, sizeof(wb_buf));
Not needed

> +                       err = ufshcd_get_wb_alloc_units(hba, lun, wb_buf);
> +                       if (err)
> +                               break;
> +
> +                       res = wb_buf[0] << 24 | wb_buf[1] << 16 |
> +                               wb_buf[2] << 8 | wb_buf[3];
> +                       if (res) {
> +                               hba->dev_info.wb_config_lun = true;
> +                               break;
> +                       }
> +               }
> +       }
> +

Thanks,
Avri




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [Linux for Sparc]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux