[PATCH] ASoC: rockchip: i2s: simplify clock handling and error cleanup in probe

kernel test robot lkp at intel.com
Sat Jul 12 10:56:13 PDT 2025


Hi Troy,

kernel test robot noticed the following build warnings:

[auto build test WARNING on 733923397fd95405a48f165c9b1fbc8c4b0a4681]

url:    https://github.com/intel-lab-lkp/linux/commits/Troy-Mitchell/ASoC-rockchip-i2s-simplify-clock-handling-and-error-cleanup-in-probe/20250712-215647
base:   733923397fd95405a48f165c9b1fbc8c4b0a4681
patch link:    https://lore.kernel.org/r/20250712-rockchip-i2s-simplify-clk-v1-1-3b23fd1b3e26%40linux.dev
patch subject: [PATCH] ASoC: rockchip: i2s: simplify clock handling and error cleanup in probe
config: x86_64-buildonly-randconfig-003-20250712 (https://download.01.org/0day-ci/archive/20250713/202507130140.HxI37WQ3-lkp@intel.com/config)
compiler: clang version 20.1.8 (https://github.com/llvm/llvm-project 87f0227cb60147a26a1eeb4fb06e3b505e9c7261)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250713/202507130140.HxI37WQ3-lkp@intel.com/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 at intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202507130140.HxI37WQ3-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> sound/soc/rockchip/rockchip_i2s.c:776:36: warning: variable 'ret' is uninitialized when used here [-Wuninitialized]
     776 |                 return dev_err_probe(&pdev->dev, ret, "Failed to initialise managed register map");
         |                                                  ^~~
   sound/soc/rockchip/rockchip_i2s.c:742:9: note: initialize the variable 'ret' to silence this warning
     742 |         int ret;
         |                ^
         |                 = 0
   1 warning generated.


vim +/ret +776 sound/soc/rockchip/rockchip_i2s.c

   733	
   734	static int rockchip_i2s_probe(struct platform_device *pdev)
   735	{
   736		struct device_node *node = pdev->dev.of_node;
   737		struct rk_i2s_dev *i2s;
   738		struct snd_soc_dai_driver *dai;
   739		struct resource *res;
   740		void __iomem *regs;
   741		struct clk *clk;
   742		int ret;
   743	
   744		i2s = devm_kzalloc(&pdev->dev, sizeof(*i2s), GFP_KERNEL);
   745		if (!i2s)
   746			return -ENOMEM;
   747	
   748		spin_lock_init(&i2s->lock);
   749		i2s->dev = &pdev->dev;
   750	
   751		i2s->grf = syscon_regmap_lookup_by_phandle(node, "rockchip,grf");
   752		if (!IS_ERR(i2s->grf)) {
   753			i2s->pins = device_get_match_data(&pdev->dev);
   754			if (!i2s->pins)
   755				return -EINVAL;
   756	
   757		}
   758	
   759		/* try to prepare related clocks */
   760		clk = devm_clk_get_enabled(&pdev->dev, "i2s_hclk");
   761		if (IS_ERR(clk))
   762			return dev_err_probe(&pdev->dev, PTR_ERR(clk), "hclock enable failed");
   763	
   764		i2s->mclk = devm_clk_get(&pdev->dev, "i2s_clk");
   765		if (IS_ERR(i2s->mclk))
   766			return dev_err_probe(&pdev->dev, PTR_ERR(i2s->mclk),
   767					     "Can't retrieve i2s master clock");
   768	
   769		regs = devm_platform_get_and_ioremap_resource(pdev, 0, &res);
   770		if (IS_ERR(regs))
   771			dev_err_probe(&pdev->dev, PTR_ERR(regs), "Can't ioremap registers");
   772	
   773		i2s->regmap = devm_regmap_init_mmio(&pdev->dev, regs,
   774						    &rockchip_i2s_regmap_config);
   775		if (IS_ERR(i2s->regmap))
 > 776			return dev_err_probe(&pdev->dev, ret, "Failed to initialise managed register map");
   777	
   778		i2s->bclk_ratio = 64;
   779		i2s->pinctrl = devm_pinctrl_get(&pdev->dev);
   780		if (!IS_ERR(i2s->pinctrl)) {
   781			i2s->bclk_on = pinctrl_lookup_state(i2s->pinctrl, "bclk_on");
   782			if (!IS_ERR_OR_NULL(i2s->bclk_on)) {
   783				i2s->bclk_off = pinctrl_lookup_state(i2s->pinctrl, "bclk_off");
   784				if (IS_ERR_OR_NULL(i2s->bclk_off))
   785					return dev_err_probe(&pdev->dev, -EINVAL,
   786							     "failed to find i2s bclk_off");
   787			}
   788		} else {
   789			dev_dbg(&pdev->dev, "failed to find i2s pinctrl\n");
   790		}
   791	
   792		i2s_pinctrl_select_bclk_off(i2s);
   793	
   794		dev_set_drvdata(&pdev->dev, i2s);
   795	
   796		pm_runtime_enable(&pdev->dev);
   797		if (!pm_runtime_enabled(&pdev->dev)) {
   798			ret = i2s_runtime_resume(&pdev->dev);
   799			if (ret)
   800				goto err_pm_disable;
   801		}
   802	
   803		ret = rockchip_i2s_init_dai(i2s, res, &dai);
   804		if (ret)
   805			goto err_pm_disable;
   806	
   807		ret = devm_snd_soc_register_component(&pdev->dev,
   808						      &rockchip_i2s_component,
   809						      dai, 1);
   810	
   811		if (ret) {
   812			dev_err(&pdev->dev, "Could not register DAI\n");
   813			goto err_suspend;
   814		}
   815	
   816		ret = devm_snd_dmaengine_pcm_register(&pdev->dev, NULL, 0);
   817		if (ret) {
   818			dev_err(&pdev->dev, "Could not register PCM\n");
   819			goto err_suspend;
   820		}
   821	
   822		return 0;
   823	
   824	err_suspend:
   825		if (!pm_runtime_status_suspended(&pdev->dev))
   826			i2s_runtime_suspend(&pdev->dev);
   827	err_pm_disable:
   828		pm_runtime_disable(&pdev->dev);
   829		return ret;
   830	}
   831	

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



More information about the Linux-rockchip mailing list