sound/soc/codecs/ak4642.c:646:24: sparse: sparse: Using plain integer as NULL pointer

From: kernel test robot
Date: Fri Sep 22 2023 - 20:06:48 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 8018e02a87031a5e8afcbd9d35133edd520076bb
commit: 3cd8cc98d63492f6f69edd4486c9bd1fe29f91c3 platform/x86: Drop the PMC_ATOM Kconfig option
date: 1 year, 3 months ago
config: i386-randconfig-061-20230923 (https://download.01.org/0day-ci/archive/20230923/202309230808.muWc0Phh-lkp@xxxxxxxxx/config)
compiler: gcc-7 (Ubuntu 7.5.0-6ubuntu2) 7.5.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20230923/202309230808.muWc0Phh-lkp@xxxxxxxxx/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202309230808.muWc0Phh-lkp@xxxxxxxxx/

sparse warnings: (new ones prefixed by >>)
>> sound/soc/codecs/ak4642.c:646:24: sparse: sparse: Using plain integer as NULL pointer

vim +646 sound/soc/codecs/ak4642.c

171a0138ab75fc Kuninori Morimoto 2015-09-10 631
27204ca8b98116 Kiran Padwal 2014-07-28 632 static const struct of_device_id ak4642_of_match[];
e654a1331f6855 Stephen Kitt 2022-04-15 633 static const struct i2c_device_id ak4642_i2c_id[];
e654a1331f6855 Stephen Kitt 2022-04-15 634 static int ak4642_i2c_probe(struct i2c_client *i2c)
a3a83d9a7cb0ce Kuninori Morimoto 2009-08-21 635 {
2719a752b6e96b Kuninori Morimoto 2015-09-10 636 struct device *dev = &i2c->dev;
2719a752b6e96b Kuninori Morimoto 2015-09-10 637 struct device_node *np = dev->of_node;
d815c703cedbc7 Sascha Hauer 2014-05-14 638 const struct ak4642_drvdata *drvdata = NULL;
4574cd94a717ef Mark Brown 2013-11-28 639 struct regmap *regmap;
d815c703cedbc7 Sascha Hauer 2014-05-14 640 struct ak4642_priv *priv;
171a0138ab75fc Kuninori Morimoto 2015-09-10 641 struct clk *mcko = NULL;
bbf1453e28e4e3 Kuninori Morimoto 2013-01-10 642
bbf1453e28e4e3 Kuninori Morimoto 2013-01-10 643 if (np) {
bbf1453e28e4e3 Kuninori Morimoto 2013-01-10 644 const struct of_device_id *of_id;
bbf1453e28e4e3 Kuninori Morimoto 2013-01-10 645
171a0138ab75fc Kuninori Morimoto 2015-09-10 @646 mcko = ak4642_of_parse_mcko(dev);
171a0138ab75fc Kuninori Morimoto 2015-09-10 647 if (IS_ERR(mcko))
171a0138ab75fc Kuninori Morimoto 2015-09-10 648 mcko = NULL;
171a0138ab75fc Kuninori Morimoto 2015-09-10 649
2719a752b6e96b Kuninori Morimoto 2015-09-10 650 of_id = of_match_device(ak4642_of_match, dev);
bbf1453e28e4e3 Kuninori Morimoto 2013-01-10 651 if (of_id)
d815c703cedbc7 Sascha Hauer 2014-05-14 652 drvdata = of_id->data;
bbf1453e28e4e3 Kuninori Morimoto 2013-01-10 653 } else {
e654a1331f6855 Stephen Kitt 2022-04-15 654 const struct i2c_device_id *id =
e654a1331f6855 Stephen Kitt 2022-04-15 655 i2c_match_id(ak4642_i2c_id, i2c);
d815c703cedbc7 Sascha Hauer 2014-05-14 656 drvdata = (const struct ak4642_drvdata *)id->driver_data;
bbf1453e28e4e3 Kuninori Morimoto 2013-01-10 657 }
bbf1453e28e4e3 Kuninori Morimoto 2013-01-10 658
d815c703cedbc7 Sascha Hauer 2014-05-14 659 if (!drvdata) {
2719a752b6e96b Kuninori Morimoto 2015-09-10 660 dev_err(dev, "Unknown device type\n");
bbf1453e28e4e3 Kuninori Morimoto 2013-01-10 661 return -EINVAL;
bbf1453e28e4e3 Kuninori Morimoto 2013-01-10 662 }
bbf1453e28e4e3 Kuninori Morimoto 2013-01-10 663
2719a752b6e96b Kuninori Morimoto 2015-09-10 664 priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
d815c703cedbc7 Sascha Hauer 2014-05-14 665 if (!priv)
d815c703cedbc7 Sascha Hauer 2014-05-14 666 return -ENOMEM;
d815c703cedbc7 Sascha Hauer 2014-05-14 667
d815c703cedbc7 Sascha Hauer 2014-05-14 668 priv->drvdata = drvdata;
171a0138ab75fc Kuninori Morimoto 2015-09-10 669 priv->mcko = mcko;
d815c703cedbc7 Sascha Hauer 2014-05-14 670
d815c703cedbc7 Sascha Hauer 2014-05-14 671 i2c_set_clientdata(i2c, priv);
d815c703cedbc7 Sascha Hauer 2014-05-14 672
d815c703cedbc7 Sascha Hauer 2014-05-14 673 regmap = devm_regmap_init_i2c(i2c, drvdata->regmap_config);
4574cd94a717ef Mark Brown 2013-11-28 674 if (IS_ERR(regmap))
4574cd94a717ef Mark Brown 2013-11-28 675 return PTR_ERR(regmap);
4574cd94a717ef Mark Brown 2013-11-28 676
43c5d0f05ec55a Kuninori Morimoto 2018-01-29 677 return devm_snd_soc_register_component(dev,
43c5d0f05ec55a Kuninori Morimoto 2018-01-29 678 &soc_component_dev_ak4642, &ak4642_dai, 1);
a3a83d9a7cb0ce Kuninori Morimoto 2009-08-21 679 }
a3a83d9a7cb0ce Kuninori Morimoto 2009-08-21 680

:::::: The code at line 646 was first introduced by commit
:::::: 171a0138ab75fcbe1228c4af0442221efccfb197 ASoC: ak4642: enable to use MCKO as fixed rate output pin on DT

:::::: TO: Kuninori Morimoto <kuninori.morimoto.gx@xxxxxxxxxxx>
:::::: CC: Mark Brown <broonie@xxxxxxxxxx>

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki