Messages in this thread | | | Date | Wed, 16 Dec 2020 16:45:06 +0800 | From | kernel test robot <> | Subject | sound/soc/fsl/imx-hdmi.c:165:6: warning: variable 'ret' is used uninitialized whenever 'if' condition is true |
| |
Hi Shengjiu,
FYI, the error/warning still remains.
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master head: d01e7f10dae29eba0f9ada82b65d24e035d5b2f9 commit: 6a5f850aa83a1d844d27e3e53ca2f247e55d438b ASoC: fsl: Add imx-hdmi machine driver date: 8 days ago config: arm-randconfig-r022-20201216 (attached as .config) compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project 71601d2ac9954cb59c443cb3ae442cb106df35d4) 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 # install arm cross compiling tool for clang build # apt-get install binutils-arm-linux-gnueabi # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=6a5f850aa83a1d844d27e3e53ca2f247e55d438b git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git git fetch --no-tags linus master git checkout 6a5f850aa83a1d844d27e3e53ca2f247e55d438b # save the attached .config to linux build tree COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm
If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot <lkp@intel.com>
All warnings (new ones prefixed by >>):
>> sound/soc/fsl/imx-hdmi.c:165:6: warning: variable 'ret' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized] if ((hdmi_out && hdmi_in) || (!hdmi_out && !hdmi_in)) { ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ sound/soc/fsl/imx-hdmi.c:212:9: note: uninitialized use occurs here return ret; ^~~ sound/soc/fsl/imx-hdmi.c:165:2: note: remove the 'if' if its condition is always false if ((hdmi_out && hdmi_in) || (!hdmi_out && !hdmi_in)) { ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ >> sound/soc/fsl/imx-hdmi.c:165:6: warning: variable 'ret' is used uninitialized whenever '||' condition is true [-Wsometimes-uninitialized] if ((hdmi_out && hdmi_in) || (!hdmi_out && !hdmi_in)) { ^~~~~~~~~~~~~~~~~~~~~ sound/soc/fsl/imx-hdmi.c:212:9: note: uninitialized use occurs here return ret; ^~~ sound/soc/fsl/imx-hdmi.c:165:6: note: remove the '||' if its condition is always false if ((hdmi_out && hdmi_in) || (!hdmi_out && !hdmi_in)) { ^~~~~~~~~~~~~~~~~~~~~~~~ sound/soc/fsl/imx-hdmi.c:110:9: note: initialize the variable 'ret' to silence this warning int ret; ^ = 0 2 warnings generated.
vim +165 sound/soc/fsl/imx-hdmi.c
100 101 static int imx_hdmi_probe(struct platform_device *pdev) 102 { 103 struct device_node *np = pdev->dev.of_node; 104 bool hdmi_out = of_property_read_bool(np, "hdmi-out"); 105 bool hdmi_in = of_property_read_bool(np, "hdmi-in"); 106 struct snd_soc_dai_link_component *dlc; 107 struct platform_device *cpu_pdev; 108 struct device_node *cpu_np; 109 struct imx_hdmi_data *data; 110 int ret; 111 112 dlc = devm_kzalloc(&pdev->dev, 3 * sizeof(*dlc), GFP_KERNEL); 113 if (!dlc) 114 return -ENOMEM; 115 116 cpu_np = of_parse_phandle(np, "audio-cpu", 0); 117 if (!cpu_np) { 118 dev_err(&pdev->dev, "cpu dai phandle missing or invalid\n"); 119 ret = -EINVAL; 120 goto fail; 121 } 122 123 cpu_pdev = of_find_device_by_node(cpu_np); 124 if (!cpu_pdev) { 125 dev_err(&pdev->dev, "failed to find SAI platform device\n"); 126 ret = -EINVAL; 127 goto fail; 128 } 129 130 data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL); 131 if (!data) { 132 ret = -ENOMEM; 133 goto fail; 134 } 135 136 data->dai.cpus = &dlc[0]; 137 data->dai.num_cpus = 1; 138 data->dai.platforms = &dlc[1]; 139 data->dai.num_platforms = 1; 140 data->dai.codecs = &dlc[2]; 141 data->dai.num_codecs = 1; 142 143 data->dai.name = "i.MX HDMI"; 144 data->dai.stream_name = "i.MX HDMI"; 145 data->dai.cpus->dai_name = dev_name(&cpu_pdev->dev); 146 data->dai.platforms->of_node = cpu_np; 147 data->dai.ops = &imx_hdmi_ops; 148 data->dai.playback_only = true; 149 data->dai.capture_only = false; 150 data->dai.init = imx_hdmi_init; 151 152 if (of_node_name_eq(cpu_np, "sai")) { 153 data->cpu_priv.sysclk_id[1] = FSL_SAI_CLK_MAST1; 154 data->cpu_priv.sysclk_id[0] = FSL_SAI_CLK_MAST1; 155 } 156 157 if (of_device_is_compatible(np, "fsl,imx-audio-sii902x")) { 158 data->dai_fmt = SND_SOC_DAIFMT_LEFT_J; 159 data->cpu_priv.slot_width = 24; 160 } else { 161 data->dai_fmt = SND_SOC_DAIFMT_I2S; 162 data->cpu_priv.slot_width = 32; 163 } 164 > 165 if ((hdmi_out && hdmi_in) || (!hdmi_out && !hdmi_in)) { 166 dev_err(&pdev->dev, "Invalid HDMI DAI link\n"); 167 goto fail; 168 } 169 170 if (hdmi_out) { 171 data->dai.playback_only = true; 172 data->dai.capture_only = false; 173 data->dai.codecs->dai_name = "i2s-hifi"; 174 data->dai.codecs->name = "hdmi-audio-codec.1"; 175 data->dai.dai_fmt = data->dai_fmt | 176 SND_SOC_DAIFMT_NB_NF | 177 SND_SOC_DAIFMT_CBS_CFS; 178 } 179 180 if (hdmi_in) { 181 data->dai.playback_only = false; 182 data->dai.capture_only = true; 183 data->dai.codecs->dai_name = "i2s-hifi"; 184 data->dai.codecs->name = "hdmi-audio-codec.2"; 185 data->dai.dai_fmt = data->dai_fmt | 186 SND_SOC_DAIFMT_NB_NF | 187 SND_SOC_DAIFMT_CBM_CFM; 188 } 189 190 data->card.dapm_widgets = imx_hdmi_widgets; 191 data->card.num_dapm_widgets = ARRAY_SIZE(imx_hdmi_widgets); 192 data->card.dev = &pdev->dev; 193 data->card.owner = THIS_MODULE; 194 ret = snd_soc_of_parse_card_name(&data->card, "model"); 195 if (ret) 196 goto fail; 197 198 data->card.num_links = 1; 199 data->card.dai_link = &data->dai; 200 201 snd_soc_card_set_drvdata(&data->card, data); 202 ret = devm_snd_soc_register_card(&pdev->dev, &data->card); 203 if (ret) { 204 dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n", ret); 205 goto fail; 206 } 207 208 fail: 209 if (cpu_np) 210 of_node_put(cpu_np); 211 212 return ret; 213 } 214
--- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org [unhandled content-type:application/gzip] | |