lkml.org 
[lkml]   [2018]   [Sep]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH V14 1/2] scsi: ufs: set the device reference clock setting
Date

>+static struct ufs_ref_clk ufs_ref_clk_freqs[] = {
>+ {19200000, REF_CLK_FREQ_19_2_MHZ},
>+ {26000000, REF_CLK_FREQ_26_MHZ},
>+ {38400000, REF_CLK_FREQ_38_4_MHZ},
>+ {52000000, REF_CLK_FREQ_52_MHZ},
>+ {0, REF_CLK_FREQ_INVAL},
>+};
>+
>+static inline enum ufs_ref_clk_freq
>+ufs_get_bref_clk_from_hz(u32 freq)
>+{
>+ int i = 0;
>+
>+ while (ufs_ref_clk_freqs[i].freq_hz != freq) {
>+ if (!ufs_ref_clk_freqs[i].freq_hz)
>+ return REF_CLK_FREQ_INVAL;
Is the if clause really needed?
you will return REF_CLK_FREQ_INVAL anyway

>+ i++;
You might overrun here if freq is not what you've expected

>+ }
>+
>+ return ufs_ref_clk_freqs[i].val;
>+}

\
 
 \ /
  Last update: 2018-09-24 09:59    [W:1.917 / U:0.628 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site