lkml.org 
[lkml]   [2020]   [May]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH v4 3/4] scsi: ufs: cleanup ufs initialization path
From
Date
On Sat, 2020-05-30 at 06:37 +0000, Avri Altman wrote:
> > + /* Get the length of descriptor */
> > + ufshcd_map_desc_id_to_length(hba, desc_id, &buff_len);
> > + if (!buff_len) {
> > + dev_err(hba->dev, "%s: Failed to get desc length",
> > __func__);
> > + return -EINVAL;
> > }
> >
> > /* Check whether we need temp memory */
>
> The first time we are reading the descriptor, we no longer can rely
> on its true size.
> So for this check, buff_len is 256 and kmalloc will always happen.
> Do you think that this check is still relevant?
>
> /* Check whether we need temp memory */
> if (param_offset != 0 || param_size < buff_len) {
> desc_buf = kmalloc(buff_len, GFP_KERNEL);
> if (!desc_buf)
> return -ENOMEM;
> } else {
> desc_buf = param_read_buf;
> is_kmalloc = false;
> }

Avri
I found this checkup is still needed since LU descriptor read will
multiple enter this function. so I didn't delete it in the new version
patch.

thanks,
Bean

\
 
 \ /
  Last update: 2020-05-31 17:12    [W:0.052 / U:10.520 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site