sound/soc/codecs/tlv320aic32x4.c:1202:18: warning: cast to smaller integer type 'enum aic32x4_type' from 'void *'

From: kernel test robot
Date: Sat Nov 20 2021 - 01:09:02 EST


Hi Claudius,

FYI, the error/warning still remains.

tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: a90af8f15bdc9449ee2d24e1d73fa3f7e8633f81
commit: 688d47cdd9344b1485eb28c2a7aa99743ed529a3 ASoC: tlv320aic32x4: add type to device private data struct
date: 5 months ago
config: x86_64-randconfig-a005-20211116 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project fbe72e41b99dc7994daac300d208a955be3e4a0a)
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://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=688d47cdd9344b1485eb28c2a7aa99743ed529a3
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout 688d47cdd9344b1485eb28c2a7aa99743ed529a3
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 ARCH=x86_64

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All warnings (new ones prefixed by >>):

>> sound/soc/codecs/tlv320aic32x4.c:1202:18: warning: cast to smaller integer type 'enum aic32x4_type' from 'void *' [-Wvoid-pointer-to-enum-cast]
aic32x4->type = (enum aic32x4_type)dev_get_drvdata(dev);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.


vim +1202 sound/soc/codecs/tlv320aic32x4.c

1185
1186 int aic32x4_probe(struct device *dev, struct regmap *regmap)
1187 {
1188 struct aic32x4_priv *aic32x4;
1189 struct aic32x4_pdata *pdata = dev->platform_data;
1190 struct device_node *np = dev->of_node;
1191 int ret;
1192
1193 if (IS_ERR(regmap))
1194 return PTR_ERR(regmap);
1195
1196 aic32x4 = devm_kzalloc(dev, sizeof(struct aic32x4_priv),
1197 GFP_KERNEL);
1198 if (aic32x4 == NULL)
1199 return -ENOMEM;
1200
1201 aic32x4->dev = dev;
> 1202 aic32x4->type = (enum aic32x4_type)dev_get_drvdata(dev);
1203
1204 dev_set_drvdata(dev, aic32x4);
1205
1206 if (pdata) {
1207 aic32x4->power_cfg = pdata->power_cfg;
1208 aic32x4->swapdacs = pdata->swapdacs;
1209 aic32x4->micpga_routing = pdata->micpga_routing;
1210 aic32x4->rstn_gpio = pdata->rstn_gpio;
1211 aic32x4->mclk_name = "mclk";
1212 } else if (np) {
1213 ret = aic32x4_parse_dt(aic32x4, np);
1214 if (ret) {
1215 dev_err(dev, "Failed to parse DT node\n");
1216 return ret;
1217 }
1218 } else {
1219 aic32x4->power_cfg = 0;
1220 aic32x4->swapdacs = false;
1221 aic32x4->micpga_routing = 0;
1222 aic32x4->rstn_gpio = -1;
1223 aic32x4->mclk_name = "mclk";
1224 }
1225
1226 if (gpio_is_valid(aic32x4->rstn_gpio)) {
1227 ret = devm_gpio_request_one(dev, aic32x4->rstn_gpio,
1228 GPIOF_OUT_INIT_LOW, "tlv320aic32x4 rstn");
1229 if (ret != 0)
1230 return ret;
1231 }
1232
1233 ret = aic32x4_setup_regulators(dev, aic32x4);
1234 if (ret) {
1235 dev_err(dev, "Failed to setup regulators\n");
1236 return ret;
1237 }
1238
1239 if (gpio_is_valid(aic32x4->rstn_gpio)) {
1240 ndelay(10);
1241 gpio_set_value_cansleep(aic32x4->rstn_gpio, 1);
1242 mdelay(1);
1243 }
1244
1245 ret = regmap_write(regmap, AIC32X4_RESET, 0x01);
1246 if (ret)
1247 goto err_disable_regulators;
1248
1249 ret = aic32x4_register_clocks(dev, aic32x4->mclk_name);
1250 if (ret)
1251 goto err_disable_regulators;
1252
1253 ret = devm_snd_soc_register_component(dev,
1254 &soc_component_dev_aic32x4, &aic32x4_dai, 1);
1255 if (ret) {
1256 dev_err(dev, "Failed to register component\n");
1257 goto err_disable_regulators;
1258 }
1259
1260 return 0;
1261
1262 err_disable_regulators:
1263 aic32x4_disable_regulators(aic32x4);
1264
1265 return ret;
1266 }
1267 EXPORT_SYMBOL(aic32x4_probe);
1268

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip