Content-Type: multipart/mixed; boundary="===============0355070056341342526==" MIME-Version: 1.0 From: kernel test robot To: kbuild-all@lists.01.org Subject: Re: [PATCH V5 4/6] clk: imx: Add clock configuration for ARMv7 platforms Date: Sat, 04 Jul 2020 09:36:45 +0800 Message-ID: <202007040904.GwZLuZrO%lkp@intel.com> In-Reply-To: <1593703441-16944-5-git-send-email-Anson.Huang@nxp.com> List-Id: --===============0355070056341342526== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Hi Anson, Thank you for the patch! Perhaps something to improve: [auto build test WARNING on shawnguo/for-next] [also build test WARNING on clk/clk-next v5.8-rc3 next-20200703] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use as documented in https://git-scm.com/docs/git-format-patch] url: https://github.com/0day-ci/linux/commits/Anson-Huang/Support-buildi= ng-i-MX-ARMv7-ARMv8-platforms-clock-driver-as-module/20200702-233004 base: https://git.kernel.org/pub/scm/linux/kernel/git/shawnguo/linux.git = for-next compiler: gcc-9 (Debian 9.3.0-14) 9.3.0 If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot cppcheck warnings: (new ones prefixed by >>) >> drivers/clk/imx/clk-composite-8m.c:119:9: warning: Identical condition '= ret', second condition is always false [identicalConditionAfterEarlyExit] return ret; ^ drivers/clk/imx/clk-composite-8m.c:104:6: note: first condition if (ret) ^ drivers/clk/imx/clk-composite-8m.c:119:9: note: second condition return ret; ^ >> drivers/clk/imx/clk-composite-8m.c:233:5: warning: Variable 'hw' is reas= signed a value before the old one has been used. [redundantAssignment] hw =3D clk_hw_register_composite(NULL, name, parent_names, num_parents, ^ drivers/clk/imx/clk-composite-8m.c:180:0: note: Variable 'hw' is reassig= ned a value before the old one has been used. struct clk_hw *hw =3D ERR_PTR(-ENOMEM), *mux_hw; ^ drivers/clk/imx/clk-composite-8m.c:233:5: note: Variable 'hw' is reassig= ned a value before the old one has been used. hw =3D clk_hw_register_composite(NULL, name, parent_names, num_parents, ^ -- >> drivers/clk/imx/clk-imx6sl.c:149:49: warning: Shifting signed 32-bit val= ue by 31 bits is undefined behaviour [shiftTooManyBitsSigned] while (!(__raw_readl(anatop_base + PLL_ARM) & BM_PLL_ARM_LOCK)) ^ vim +/ret +119 drivers/clk/imx/clk-composite-8m.c d3ff9728134eea Abel Vesa 2018-12-01 90 = d3ff9728134eea Abel Vesa 2018-12-01 91 static int imx8m_clk_composi= te_divider_set_rate(struct clk_hw *hw, d3ff9728134eea Abel Vesa 2018-12-01 92 unsigned long rate, d3ff9728134eea Abel Vesa 2018-12-01 93 unsigned long parent_ra= te) d3ff9728134eea Abel Vesa 2018-12-01 94 { d3ff9728134eea Abel Vesa 2018-12-01 95 struct clk_divider *divider= =3D to_clk_divider(hw); 79ccef698ac811 Anson Huang 2020-02-12 96 unsigned long flags; d3ff9728134eea Abel Vesa 2018-12-01 97 int prediv_value; d3ff9728134eea Abel Vesa 2018-12-01 98 int div_value; 33e7a8422546b5 Colin Ian King 2018-12-09 99 int ret; d3ff9728134eea Abel Vesa 2018-12-01 100 u32 val; d3ff9728134eea Abel Vesa 2018-12-01 101 = d3ff9728134eea Abel Vesa 2018-12-01 102 ret =3D imx8m_clk_composite= _compute_dividers(rate, parent_rate, d3ff9728134eea Abel Vesa 2018-12-01 103 &prediv_value, &div_va= lue); d3ff9728134eea Abel Vesa 2018-12-01 104 if (ret) d3ff9728134eea Abel Vesa 2018-12-01 105 return -EINVAL; d3ff9728134eea Abel Vesa 2018-12-01 106 = d3ff9728134eea Abel Vesa 2018-12-01 107 spin_lock_irqsave(divider->= lock, flags); d3ff9728134eea Abel Vesa 2018-12-01 108 = d3ff9728134eea Abel Vesa 2018-12-01 109 val =3D readl(divider->reg); d3ff9728134eea Abel Vesa 2018-12-01 110 val &=3D ~((clk_div_mask(di= vider->width) << divider->shift) | d3ff9728134eea Abel Vesa 2018-12-01 111 (clk_div_mask(PCG_DIV_WID= TH) << PCG_DIV_SHIFT)); d3ff9728134eea Abel Vesa 2018-12-01 112 = d3ff9728134eea Abel Vesa 2018-12-01 113 val |=3D (u32)(prediv_value= - 1) << divider->shift; d3ff9728134eea Abel Vesa 2018-12-01 114 val |=3D (u32)(div_value - = 1) << PCG_DIV_SHIFT; d3ff9728134eea Abel Vesa 2018-12-01 115 writel(val, divider->reg); d3ff9728134eea Abel Vesa 2018-12-01 116 = d3ff9728134eea Abel Vesa 2018-12-01 117 spin_unlock_irqrestore(divi= der->lock, flags); d3ff9728134eea Abel Vesa 2018-12-01 118 = d3ff9728134eea Abel Vesa 2018-12-01 @119 return ret; d3ff9728134eea Abel Vesa 2018-12-01 120 } d3ff9728134eea Abel Vesa 2018-12-01 121 = d3ff9728134eea Abel Vesa 2018-12-01 122 static const struct clk_ops = imx8m_clk_composite_divider_ops =3D { d3ff9728134eea Abel Vesa 2018-12-01 123 .recalc_rate =3D imx8m_clk_= composite_divider_recalc_rate, d3ff9728134eea Abel Vesa 2018-12-01 124 .round_rate =3D imx8m_clk_c= omposite_divider_round_rate, d3ff9728134eea Abel Vesa 2018-12-01 125 .set_rate =3D imx8m_clk_com= posite_divider_set_rate, d3ff9728134eea Abel Vesa 2018-12-01 126 }; d3ff9728134eea Abel Vesa 2018-12-01 127 = f90b68d6c8b008 Peng Fan 2020-05-07 128 static u8 imx8m_clk_composit= e_mux_get_parent(struct clk_hw *hw) f90b68d6c8b008 Peng Fan 2020-05-07 129 { f90b68d6c8b008 Peng Fan 2020-05-07 130 return clk_mux_ops.get_pare= nt(hw); f90b68d6c8b008 Peng Fan 2020-05-07 131 } f90b68d6c8b008 Peng Fan 2020-05-07 132 = f90b68d6c8b008 Peng Fan 2020-05-07 133 static int imx8m_clk_composi= te_mux_set_parent(struct clk_hw *hw, u8 index) f90b68d6c8b008 Peng Fan 2020-05-07 134 { f90b68d6c8b008 Peng Fan 2020-05-07 135 struct clk_mux *mux =3D to_= clk_mux(hw); f90b68d6c8b008 Peng Fan 2020-05-07 136 u32 val =3D clk_mux_index_t= o_val(mux->table, mux->flags, index); f90b68d6c8b008 Peng Fan 2020-05-07 137 unsigned long flags =3D 0; f90b68d6c8b008 Peng Fan 2020-05-07 138 u32 reg; f90b68d6c8b008 Peng Fan 2020-05-07 139 = f90b68d6c8b008 Peng Fan 2020-05-07 140 if (mux->lock) f90b68d6c8b008 Peng Fan 2020-05-07 141 spin_lock_irqsave(mux->loc= k, flags); f90b68d6c8b008 Peng Fan 2020-05-07 142 = f90b68d6c8b008 Peng Fan 2020-05-07 143 reg =3D readl(mux->reg); f90b68d6c8b008 Peng Fan 2020-05-07 144 reg &=3D ~(mux->mask << mux= ->shift); f90b68d6c8b008 Peng Fan 2020-05-07 145 val =3D val << mux->shift; f90b68d6c8b008 Peng Fan 2020-05-07 146 reg |=3D val; f90b68d6c8b008 Peng Fan 2020-05-07 147 /* f90b68d6c8b008 Peng Fan 2020-05-07 148 * write twice to make sure= non-target interface f90b68d6c8b008 Peng Fan 2020-05-07 149 * SEL_A/B point the same c= lk input. f90b68d6c8b008 Peng Fan 2020-05-07 150 */ f90b68d6c8b008 Peng Fan 2020-05-07 151 writel(reg, mux->reg); f90b68d6c8b008 Peng Fan 2020-05-07 152 writel(reg, mux->reg); f90b68d6c8b008 Peng Fan 2020-05-07 153 = f90b68d6c8b008 Peng Fan 2020-05-07 154 if (mux->lock) f90b68d6c8b008 Peng Fan 2020-05-07 155 spin_unlock_irqrestore(mux= ->lock, flags); f90b68d6c8b008 Peng Fan 2020-05-07 156 = f90b68d6c8b008 Peng Fan 2020-05-07 157 return 0; f90b68d6c8b008 Peng Fan 2020-05-07 158 } f90b68d6c8b008 Peng Fan 2020-05-07 159 = f90b68d6c8b008 Peng Fan 2020-05-07 160 static int f90b68d6c8b008 Peng Fan 2020-05-07 161 imx8m_clk_composite_mux_dete= rmine_rate(struct clk_hw *hw, f90b68d6c8b008 Peng Fan 2020-05-07 162 struct clk_rate_r= equest *req) f90b68d6c8b008 Peng Fan 2020-05-07 163 { f90b68d6c8b008 Peng Fan 2020-05-07 164 return clk_mux_ops.determin= e_rate(hw, req); f90b68d6c8b008 Peng Fan 2020-05-07 165 } f90b68d6c8b008 Peng Fan 2020-05-07 166 = f90b68d6c8b008 Peng Fan 2020-05-07 167 = f90b68d6c8b008 Peng Fan 2020-05-07 168 static const struct clk_ops = imx8m_clk_composite_mux_ops =3D { f90b68d6c8b008 Peng Fan 2020-05-07 169 .get_parent =3D imx8m_clk_c= omposite_mux_get_parent, f90b68d6c8b008 Peng Fan 2020-05-07 170 .set_parent =3D imx8m_clk_c= omposite_mux_set_parent, f90b68d6c8b008 Peng Fan 2020-05-07 171 .determine_rate =3D imx8m_c= lk_composite_mux_determine_rate, f90b68d6c8b008 Peng Fan 2020-05-07 172 }; f90b68d6c8b008 Peng Fan 2020-05-07 173 = a4b431f8038a67 Peng Fan 2019-12-12 174 struct clk_hw *imx8m_clk_hw_= composite_flags(const char *name, 65a6b7c5f31c39 Abel Vesa 2018-12-14 175 const char * const *par= ent_names, d3ff9728134eea Abel Vesa 2018-12-01 176 int num_parents, void _= _iomem *reg, 62668b68dc8e7d Peng Fan 2020-01-28 177 u32 composite_flags, d3ff9728134eea Abel Vesa 2018-12-01 178 unsigned long flags) d3ff9728134eea Abel Vesa 2018-12-01 179 { d3ff9728134eea Abel Vesa 2018-12-01 180 struct clk_hw *hw =3D ERR_P= TR(-ENOMEM), *mux_hw; d3ff9728134eea Abel Vesa 2018-12-01 181 struct clk_hw *div_hw, *gat= e_hw; d3ff9728134eea Abel Vesa 2018-12-01 182 struct clk_divider *div =3D= NULL; d3ff9728134eea Abel Vesa 2018-12-01 183 struct clk_gate *gate =3D N= ULL; d3ff9728134eea Abel Vesa 2018-12-01 184 struct clk_mux *mux =3D NUL= L; 62668b68dc8e7d Peng Fan 2020-01-28 185 const struct clk_ops *divid= er_ops; f90b68d6c8b008 Peng Fan 2020-05-07 186 const struct clk_ops *mux_o= ps; d3ff9728134eea Abel Vesa 2018-12-01 187 = d3ff9728134eea Abel Vesa 2018-12-01 188 mux =3D kzalloc(sizeof(*mux= ), GFP_KERNEL); d3ff9728134eea Abel Vesa 2018-12-01 189 if (!mux) d3ff9728134eea Abel Vesa 2018-12-01 190 goto fail; d3ff9728134eea Abel Vesa 2018-12-01 191 = d3ff9728134eea Abel Vesa 2018-12-01 192 mux_hw =3D &mux->hw; d3ff9728134eea Abel Vesa 2018-12-01 193 mux->reg =3D reg; d3ff9728134eea Abel Vesa 2018-12-01 194 mux->shift =3D PCG_PCS_SHIF= T; d3ff9728134eea Abel Vesa 2018-12-01 195 mux->mask =3D PCG_PCS_MASK; 073a01e8d7c23b Peng Fan 2019-11-01 196 mux->lock =3D &imx_ccm_lock; d3ff9728134eea Abel Vesa 2018-12-01 197 = d3ff9728134eea Abel Vesa 2018-12-01 198 div =3D kzalloc(sizeof(*div= ), GFP_KERNEL); d3ff9728134eea Abel Vesa 2018-12-01 199 if (!div) d3ff9728134eea Abel Vesa 2018-12-01 200 goto fail; d3ff9728134eea Abel Vesa 2018-12-01 201 = d3ff9728134eea Abel Vesa 2018-12-01 202 div_hw =3D &div->hw; d3ff9728134eea Abel Vesa 2018-12-01 203 div->reg =3D reg; 62668b68dc8e7d Peng Fan 2020-01-28 204 if (composite_flags & IMX_C= OMPOSITE_CORE) { 62668b68dc8e7d Peng Fan 2020-01-28 205 div->shift =3D PCG_DIV_SHI= FT; 62668b68dc8e7d Peng Fan 2020-01-28 206 div->width =3D PCG_CORE_DI= V_WIDTH; 62668b68dc8e7d Peng Fan 2020-01-28 207 divider_ops =3D &clk_divid= er_ops; f90b68d6c8b008 Peng Fan 2020-05-07 208 mux_ops =3D &imx8m_clk_com= posite_mux_ops; 0e40198dc28b62 Peng Fan 2020-05-07 209 } else if (composite_flags = & IMX_COMPOSITE_BUS) { 0e40198dc28b62 Peng Fan 2020-05-07 210 div->shift =3D PCG_PREDIV_= SHIFT; 0e40198dc28b62 Peng Fan 2020-05-07 211 div->width =3D PCG_PREDIV_= WIDTH; 0e40198dc28b62 Peng Fan 2020-05-07 212 divider_ops =3D &imx8m_clk= _composite_divider_ops; 0e40198dc28b62 Peng Fan 2020-05-07 213 mux_ops =3D &imx8m_clk_com= posite_mux_ops; 62668b68dc8e7d Peng Fan 2020-01-28 214 } else { d3ff9728134eea Abel Vesa 2018-12-01 215 div->shift =3D PCG_PREDIV_= SHIFT; d3ff9728134eea Abel Vesa 2018-12-01 216 div->width =3D PCG_PREDIV_= WIDTH; 62668b68dc8e7d Peng Fan 2020-01-28 217 divider_ops =3D &imx8m_clk= _composite_divider_ops; f90b68d6c8b008 Peng Fan 2020-05-07 218 mux_ops =3D &clk_mux_ops; 62668b68dc8e7d Peng Fan 2020-01-28 219 } 62668b68dc8e7d Peng Fan 2020-01-28 220 = d3ff9728134eea Abel Vesa 2018-12-01 221 div->lock =3D &imx_ccm_lock; d3ff9728134eea Abel Vesa 2018-12-01 222 div->flags =3D CLK_DIVIDER_= ROUND_CLOSEST; d3ff9728134eea Abel Vesa 2018-12-01 223 = d3ff9728134eea Abel Vesa 2018-12-01 224 gate =3D kzalloc(sizeof(*ga= te), GFP_KERNEL); d3ff9728134eea Abel Vesa 2018-12-01 225 if (!gate) d3ff9728134eea Abel Vesa 2018-12-01 226 goto fail; d3ff9728134eea Abel Vesa 2018-12-01 227 = d3ff9728134eea Abel Vesa 2018-12-01 228 gate_hw =3D &gate->hw; d3ff9728134eea Abel Vesa 2018-12-01 229 gate->reg =3D reg; d3ff9728134eea Abel Vesa 2018-12-01 230 gate->bit_idx =3D PCG_CGC_S= HIFT; 073a01e8d7c23b Peng Fan 2019-11-01 231 gate->lock =3D &imx_ccm_loc= k; d3ff9728134eea Abel Vesa 2018-12-01 232 = d3ff9728134eea Abel Vesa 2018-12-01 @233 hw =3D clk_hw_register_comp= osite(NULL, name, parent_names, num_parents, --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org --===============0355070056341342526==--