[asahilinux:bits/260-spmi-typec 12/13] drivers/usb/typec/tipd/i2c.c:21:12: 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: c11cad9077f1a6d06b63e14a9ed37a2e8734e2c5 [12/13] usb: typec: tipd: Factor out i2c specifics
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/i2c.c:21:12: warning: cast to smaller integer type 'enum tipd_hw_variant' from 'const void *' [-Wvoid-pointer-to-enum-cast]
      21 |         variant = (enum tipd_hw_variant)i2c_get_match_data(client);
         |                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   1 warning generated.


vim +21 drivers/usb/typec/tipd/i2c.c

    13	
    14	static int tps6598x_probe_i2c(struct i2c_client *client)
    15	{
    16		enum tipd_hw_variant variant;
    17		const struct tipd_data *data;
    18		struct tps6598x *tps;
    19		int ret;
    20	
  > 21		variant = (enum tipd_hw_variant)i2c_get_match_data(client);
    22		if (!variant || variant >= TIPD_VARIANT_MAX)
    23			return -EINVAL;
    24		data = tipd_hw_variants[variant];
    25	
    26		tps = devm_kzalloc(&client->dev, data->tps_struct_size, GFP_KERNEL);
    27		if (!tps)
    28			return -ENOMEM;
    29	
    30		mutex_init(&tps->lock);
    31		tps->dev = &client->dev;
    32		tps->data = data;
    33		tps->irq = client->irq;
    34	
    35		tps->regmap = devm_regmap_init_i2c(client, &tps6598x_regmap_config);
    36		if (IS_ERR(tps->regmap))
    37			return PTR_ERR(tps->regmap);
    38	
    39		/*
    40		 * Checking can the adapter handle SMBus protocol. If it can not, the
    41		 * driver needs to take care of block reads separately.
    42		 */
    43		if (i2c_check_functionality(client->adapter, I2C_FUNC_I2C))
    44			tps->i2c_protocol = true;
    45	
    46		ret = tipd_init(tps);
    47	
    48		if (ret == 0)
    49			i2c_set_clientdata(client, tps);
    50	
    51		return ret;
    52	}
    53	

--
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.