On 21/07/26 09:32:43, [email protected] wrote:
> Hi,
> 
> On 7/20/26 10:51, Jorge Ramirez-Ortiz wrote:
> > UFS string descriptors are UTF-16 big-endian (JESD220), but
> > ufshcd_read_string_desc() fed the raw bytes to utf16_to_utf8(), which reads
> > host-endian code units, leaving dev_desc->model blank. Byte-swap to host
> > order before decoding, matching the kernel.
> > 
> > Signed-off-by: Jorge Ramirez-Ortiz <[email protected]>
> > ---
> >   drivers/ufs/ufs-uclass.c | 8 ++++++++
> >   1 file changed, 8 insertions(+)
> > 
> > diff --git a/drivers/ufs/ufs-uclass.c b/drivers/ufs/ufs-uclass.c
> > index 6a51f337e47..4d10e0b11fe 100644
> > --- a/drivers/ufs/ufs-uclass.c
> > +++ b/drivers/ufs/ufs-uclass.c
> > @@ -1765,6 +1765,14 @@ static int ufshcd_read_string_desc(struct ufs_hba 
> > *hba, int desc_index,
> >                     goto out;
> >             }
> > +           {
> > +                   u16 *ustr = (u16 *)&buf[QUERY_DESC_HDR_SIZE];
> > +                   int num_chars = (desc_len - QUERY_DESC_HDR_SIZE) / 2;
> > +
> > +                   for (i = 0; i < num_chars; i++)
> > +                           ustr[i] = be16_to_cpu(ustr[i]);
> > +           }
> 
> 
> This block looks weird in the middle of ufshcd_read_string_desc(), move it to 
> a new inline
> helper instead.

sure, sorry about it.

Reply via email to