[asahilinux:bits/260-spmi-typec 13/13] drivers/usb/typec/tipd/spmi.c:176:26: warning: cast to smaller integer type 'enum tipd_hw_variant' from 'const void *'

kernel test robot <[email protected]>
Newsgroups dev.linux.lists.oe-kbuild-all,dev.linux.lists.llvm
Message-ID <[email protected]>
tree:   https://github.com/AsahiLinux/linux bits/260-spmi-typec
head:   41abbd4a14cc0f4c24128042de99a658a83e1dde
commit: 41abbd4a14cc0f4c24128042de99a658a83e1dde [13/13] usb: typec: tipd: Add sn201202x support
config: riscv-allyesconfig (https://download.01.org/0day-ci/archive/20260827/[email protected]/config)
compiler: clang version 24.0.0git (https://github.com/llvm/llvm-project 771bdfdab2d66a4eb85b8ea7673cfa30152718b1)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260827/[email protected]/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 <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All warnings (new ones prefixed by >>):

>> drivers/usb/typec/tipd/spmi.c:176:26: warning: cast to smaller integer type 'enum tipd_hw_variant' from 'const void *' [-Wvoid-pointer-to-enum-cast]
     176 |         data = tipd_hw_variants[(enum tipd_hw_variant)match->data];
         |                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   1 warning generated.


vim +176 drivers/usb/typec/tipd/spmi.c

   163	
   164	static int sn201202x_probe(struct spmi_device *device)
   165	{
   166		const struct of_device_id *match;
   167		const struct tipd_data *data;
   168		struct sn201202x *sn;
   169		struct tps6598x *tps;
   170		int irq_select, irq_sleep, irq_wake;
   171		int ret;
   172	
   173		match = of_match_device(sn201202x_of_match, &device->dev);
   174		if (!match)
   175			return -EINVAL;
 > 176		data = tipd_hw_variants[(enum tipd_hw_variant)match->data];
   177	
   178		sn = devm_kzalloc(&device->dev, data->tps_struct_size, GFP_KERNEL);
   179		if (!sn)
   180			return -ENOMEM;
   181		sn->sdev = device;
   182		tps = &sn->cd.tps;
   183	
   184		mutex_init(&tps->lock);
   185		tps->dev = &device->dev;
   186		tps->data = data;
   187	
   188		tps->irq = of_irq_get_byname(device->dev.of_node, "irq");
   189		if (tps->irq < 0)
   190			return tps->irq;
   191		irq_select = of_irq_get_byname(device->dev.of_node, "select");
   192		if (irq_select < 0)
   193			return irq_select;
   194		irq_sleep = of_irq_get_byname(device->dev.of_node, "sleep");
   195		if (irq_sleep < 0)
   196			return irq_sleep;
   197		irq_wake = of_irq_get_byname(device->dev.of_node, "wake");
   198		if (irq_wake < 0)
   199			return irq_wake;
   200	
   201		init_completion(&sn->select_completion);
   202		init_completion(&sn->sleep_completion);
   203		init_completion(&sn->wake_completion);
   204	
   205		ret = devm_request_irq(&device->dev, irq_select, sn201202x_irq,
   206				       0, NULL, &sn->select_completion);
   207		if (ret)
   208			return ret;
   209		ret = devm_request_irq(&device->dev, irq_sleep, sn201202x_irq,
   210				       0, NULL, &sn->sleep_completion);
   211		if (ret)
   212			return ret;
   213		ret = devm_request_irq(&device->dev, irq_wake, sn201202x_irq,
   214				       0, NULL, &sn->wake_completion);
   215		if (ret)
   216			return ret;
   217	
   218		spmi_device_set_drvdata(device, tps);
   219		tps->regmap = devm_regmap_init_sn201202x(device, &tps6598x_regmap_config);
   220		if (IS_ERR(tps->regmap))
   221			return PTR_ERR(tps->regmap);
   222	
   223		ret = spmi_command_wakeup(device);
   224		if (ret)
   225			return ret;
   226		if (!wait_for_completion_timeout(&sn->wake_completion, msecs_to_jiffies(100)))
   227			return -ETIMEDOUT;
   228	
   229		ret = tipd_init(tps);
   230		if (ret)
   231			spmi_command_sleep(device);
   232		return ret;
   233	}
   234	

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.