[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <SN6PR04MB49250F1D665127DBA82137A3FC170@SN6PR04MB4925.namprd04.prod.outlook.com>
Date: Mon, 24 Sep 2018 07:58:04 +0000
From: Avri Altman <Avri.Altman@....com>
To: Sayali Lokhande <sayalil@...eaurora.org>,
"subhashj@...eaurora.org" <subhashj@...eaurora.org>,
"cang@...eaurora.org" <cang@...eaurora.org>,
"vivek.gautam@...eaurora.org" <vivek.gautam@...eaurora.org>,
"rnayak@...eaurora.org" <rnayak@...eaurora.org>,
"vinholikatti@...il.com" <vinholikatti@...il.com>,
"jejb@...ux.vnet.ibm.com" <jejb@...ux.vnet.ibm.com>,
"martin.petersen@...cle.com" <martin.petersen@...cle.com>,
"asutoshd@...eaurora.org" <asutoshd@...eaurora.org>,
"evgreen@...omium.org" <evgreen@...omium.org>,
"riteshh@...eaurora.org" <riteshh@...eaurora.org>
CC: "stummala@...eaurora.org" <stummala@...eaurora.org>,
"adrian.hunter@...el.com" <adrian.hunter@...el.com>,
"jlbec@...lplan.org" <jlbec@...lplan.org>,
"linux-scsi@...r.kernel.org" <linux-scsi@...r.kernel.org>,
open list <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH V14 1/2] scsi: ufs: set the device reference clock setting
>+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;
>+}
Powered by blists - more mailing lists