:::::: :::::: Manual check reason: "low confidence bisect report" :::::: Manual check reason: "low confidence static check warning: sound/soc/fsl/fsl_mqs.c:206:26: warning: dereference of NULL '0' [CWE-476] [-Wanalyzer-null-dereference]" ::::::
CC: kbuild-...@lists.01.org BCC: l...@intel.com CC: "GNU/Weeb Mailing List" <g...@vger.gnuweeb.org> CC: linux-ker...@vger.kernel.org TO: Shengjiu Wang <shengjiu.w...@nxp.com> CC: Mark Brown <broo...@kernel.org> tree: https://github.com/ammarfaizi2/linux-block broonie/sound/for-5.20 head: 55e1c007e1bd3b30efac683f6d7eba6d4a13928d commit: 063c915502b914a5a621458c763dfc28286f7606 [28/56] ASoC: fsl_mqs: simplify the code with adding fsl_mqs_soc_data :::::: branch date: 27 hours ago :::::: commit date: 5 days ago config: i386-randconfig-c001 (https://download.01.org/0day-ci/archive/20220612/202206120456.jvgylf6s-...@intel.com/config) compiler: gcc-11 (Debian 11.3.0-3) 11.3.0 reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # https://github.com/ammarfaizi2/linux-block/commit/063c915502b914a5a621458c763dfc28286f7606 git remote add ammarfaizi2-block https://github.com/ammarfaizi2/linux-block git fetch --no-tags ammarfaizi2-block broonie/sound/for-5.20 git checkout 063c915502b914a5a621458c763dfc28286f7606 # save the config file ARCH=i386 KBUILD_USERCFLAGS='-fanalyzer -Wno-error' If you fix the issue, kindly add following tag where applicable Reported-by: kernel test robot <l...@intel.com> gcc-analyzer warnings: (new ones prefixed by >>) sound/soc/fsl/fsl_mqs.c: In function 'fsl_mqs_probe': >> sound/soc/fsl/fsl_mqs.c:206:26: warning: dereference of NULL '0' [CWE-476] >> [-Wanalyzer-null-dereference] 206 | if (mqs_priv->soc->use_gpr) { | ~~~~~~~~~~~~~^~~~~~~~~ 'fsl_mqs_probe': events 1-4 | | 197 | if (!mqs_priv) | | ^ | | | | | (1) following 'false' branch... |...... | 204 | mqs_priv->soc = of_device_get_match_data(&pdev->dev); | | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | | | | | (2) ...to here | | (3) '0' is NULL | 205 | | 206 | if (mqs_priv->soc->use_gpr) { | | ~~~~~~~~~~~~~~~~~~~~~~ | | | | | (4) dereference of NULL '0' | vim +/0 +206 sound/soc/fsl/fsl_mqs.c 9e28f6532c611c Shengjiu Wang 2019-09-13 187 9e28f6532c611c Shengjiu Wang 2019-09-13 188 static int fsl_mqs_probe(struct platform_device *pdev) 9e28f6532c611c Shengjiu Wang 2019-09-13 189 { 9e28f6532c611c Shengjiu Wang 2019-09-13 190 struct device_node *np = pdev->dev.of_node; a9d273671440c4 Dan Carpenter 2019-10-04 191 struct device_node *gpr_np = NULL; 9e28f6532c611c Shengjiu Wang 2019-09-13 192 struct fsl_mqs *mqs_priv; 9e28f6532c611c Shengjiu Wang 2019-09-13 193 void __iomem *regs; a9d273671440c4 Dan Carpenter 2019-10-04 194 int ret; 9e28f6532c611c Shengjiu Wang 2019-09-13 195 9e28f6532c611c Shengjiu Wang 2019-09-13 196 mqs_priv = devm_kzalloc(&pdev->dev, sizeof(*mqs_priv), GFP_KERNEL); 9e28f6532c611c Shengjiu Wang 2019-09-13 197 if (!mqs_priv) 9e28f6532c611c Shengjiu Wang 2019-09-13 198 return -ENOMEM; 9e28f6532c611c Shengjiu Wang 2019-09-13 199 9e28f6532c611c Shengjiu Wang 2019-09-13 200 /* On i.MX6sx the MQS control register is in GPR domain 9e28f6532c611c Shengjiu Wang 2019-09-13 201 * But in i.MX8QM/i.MX8QXP the control register is moved 9e28f6532c611c Shengjiu Wang 2019-09-13 202 * to its own domain. 9e28f6532c611c Shengjiu Wang 2019-09-13 203 */ 063c915502b914 Shengjiu Wang 2022-05-25 204 mqs_priv->soc = of_device_get_match_data(&pdev->dev); 9e28f6532c611c Shengjiu Wang 2019-09-13 205 063c915502b914 Shengjiu Wang 2022-05-25 @206 if (mqs_priv->soc->use_gpr) { 9e28f6532c611c Shengjiu Wang 2019-09-13 207 gpr_np = of_parse_phandle(np, "gpr", 0); a9d273671440c4 Dan Carpenter 2019-10-04 208 if (!gpr_np) { 9e28f6532c611c Shengjiu Wang 2019-09-13 209 dev_err(&pdev->dev, "failed to get gpr node by phandle\n"); a9d273671440c4 Dan Carpenter 2019-10-04 210 return -EINVAL; 9e28f6532c611c Shengjiu Wang 2019-09-13 211 } 9e28f6532c611c Shengjiu Wang 2019-09-13 212 9e28f6532c611c Shengjiu Wang 2019-09-13 213 mqs_priv->regmap = syscon_node_to_regmap(gpr_np); 9e28f6532c611c Shengjiu Wang 2019-09-13 214 if (IS_ERR(mqs_priv->regmap)) { 9e28f6532c611c Shengjiu Wang 2019-09-13 215 dev_err(&pdev->dev, "failed to get gpr regmap\n"); 9e28f6532c611c Shengjiu Wang 2019-09-13 216 ret = PTR_ERR(mqs_priv->regmap); a9d273671440c4 Dan Carpenter 2019-10-04 217 goto err_free_gpr_np; 9e28f6532c611c Shengjiu Wang 2019-09-13 218 } 9e28f6532c611c Shengjiu Wang 2019-09-13 219 } else { 9e28f6532c611c Shengjiu Wang 2019-09-13 220 regs = devm_platform_ioremap_resource(pdev, 0); 9e28f6532c611c Shengjiu Wang 2019-09-13 221 if (IS_ERR(regs)) 9e28f6532c611c Shengjiu Wang 2019-09-13 222 return PTR_ERR(regs); 9e28f6532c611c Shengjiu Wang 2019-09-13 223 9e28f6532c611c Shengjiu Wang 2019-09-13 224 mqs_priv->regmap = devm_regmap_init_mmio_clk(&pdev->dev, 9e28f6532c611c Shengjiu Wang 2019-09-13 225 "core", 9e28f6532c611c Shengjiu Wang 2019-09-13 226 regs, 9e28f6532c611c Shengjiu Wang 2019-09-13 227 &fsl_mqs_regmap_config); 9e28f6532c611c Shengjiu Wang 2019-09-13 228 if (IS_ERR(mqs_priv->regmap)) { 9e28f6532c611c Shengjiu Wang 2019-09-13 229 dev_err(&pdev->dev, "failed to init regmap: %ld\n", 9e28f6532c611c Shengjiu Wang 2019-09-13 230 PTR_ERR(mqs_priv->regmap)); 9e28f6532c611c Shengjiu Wang 2019-09-13 231 return PTR_ERR(mqs_priv->regmap); 9e28f6532c611c Shengjiu Wang 2019-09-13 232 } 9e28f6532c611c Shengjiu Wang 2019-09-13 233 9e28f6532c611c Shengjiu Wang 2019-09-13 234 mqs_priv->ipg = devm_clk_get(&pdev->dev, "core"); 9e28f6532c611c Shengjiu Wang 2019-09-13 235 if (IS_ERR(mqs_priv->ipg)) { 9e28f6532c611c Shengjiu Wang 2019-09-13 236 dev_err(&pdev->dev, "failed to get the clock: %ld\n", 9e28f6532c611c Shengjiu Wang 2019-09-13 237 PTR_ERR(mqs_priv->ipg)); a9d273671440c4 Dan Carpenter 2019-10-04 238 return PTR_ERR(mqs_priv->ipg); 9e28f6532c611c Shengjiu Wang 2019-09-13 239 } 9e28f6532c611c Shengjiu Wang 2019-09-13 240 } 9e28f6532c611c Shengjiu Wang 2019-09-13 241 9e28f6532c611c Shengjiu Wang 2019-09-13 242 mqs_priv->mclk = devm_clk_get(&pdev->dev, "mclk"); 9e28f6532c611c Shengjiu Wang 2019-09-13 243 if (IS_ERR(mqs_priv->mclk)) { 9e28f6532c611c Shengjiu Wang 2019-09-13 244 dev_err(&pdev->dev, "failed to get the clock: %ld\n", 9e28f6532c611c Shengjiu Wang 2019-09-13 245 PTR_ERR(mqs_priv->mclk)); a9d273671440c4 Dan Carpenter 2019-10-04 246 ret = PTR_ERR(mqs_priv->mclk); a9d273671440c4 Dan Carpenter 2019-10-04 247 goto err_free_gpr_np; 9e28f6532c611c Shengjiu Wang 2019-09-13 248 } 9e28f6532c611c Shengjiu Wang 2019-09-13 249 9e28f6532c611c Shengjiu Wang 2019-09-13 250 dev_set_drvdata(&pdev->dev, mqs_priv); 9e28f6532c611c Shengjiu Wang 2019-09-13 251 pm_runtime_enable(&pdev->dev); 9e28f6532c611c Shengjiu Wang 2019-09-13 252 a9d273671440c4 Dan Carpenter 2019-10-04 253 ret = devm_snd_soc_register_component(&pdev->dev, &soc_codec_fsl_mqs, 9e28f6532c611c Shengjiu Wang 2019-09-13 254 &fsl_mqs_dai, 1); a9d273671440c4 Dan Carpenter 2019-10-04 255 if (ret) a9d273671440c4 Dan Carpenter 2019-10-04 256 goto err_free_gpr_np; a9d273671440c4 Dan Carpenter 2019-10-04 257 return 0; a9d273671440c4 Dan Carpenter 2019-10-04 258 a9d273671440c4 Dan Carpenter 2019-10-04 259 err_free_gpr_np: 9e28f6532c611c Shengjiu Wang 2019-09-13 260 of_node_put(gpr_np); 9e28f6532c611c Shengjiu Wang 2019-09-13 261 9e28f6532c611c Shengjiu Wang 2019-09-13 262 return ret; 9e28f6532c611c Shengjiu Wang 2019-09-13 263 } 9e28f6532c611c Shengjiu Wang 2019-09-13 264 -- 0-DAY CI Kernel Test Service https://01.org/lkp _______________________________________________ kbuild mailing list -- kbuild@lists.01.org To unsubscribe send an email to kbuild-le...@lists.01.org