drivers/i2c/busses/i2c-bcm-iproc.c:871:3: warning: cast to smaller integer type 'enum bcm_iproc_i2c_type' from 'const void *'

kernel test robot
2025-02-24T22:52:06Z

tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: d082ecbc71e9e0bf49883ee4afd435a77a5101b6
commit: 9a1038728037521d177042522bd05c3c51e744a4 i2c: iproc: add NIC I2C support
date: 6 years ago
config: x86_64-buildonly-randconfig-006-20250127 (https://download.01.org/0day-ci/archive/20250225/202502250655.7lohuY6f-lkp@intel.com/config)
compiler: clang version 19.1.3 (https://github.com/llvm/llvm-project ab51eccf88f5321e7c60591c5546b254b6afab99)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250225/202502250655.7lohuY6f-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@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202502250655.7lohuY6f-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> drivers/i2c/busses/i2c-bcm-iproc.c:871:3: warning: cast to smaller integer type 'enum bcm_iproc_i2c_type' from 'const void *' [-Wvoid-pointer-to-enum-cast]
871 | (enum bcm_iproc_i2c_type)of_device_get_match_data(&pdev->dev);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.

vim +871 drivers/i2c/busses/i2c-bcm-iproc.c

855
856 static int bcm_iproc_i2c_probe(struct platform_device *pdev)
857 {
858 int irq, ret = 0;
859 struct bcm_iproc_i2c_dev *iproc_i2c;
860 struct i2c_adapter *adap;
861 struct resource *res;
862
863 iproc_i2c = devm_kzalloc(&pdev->dev, sizeof(*iproc_i2c),
864 GFP_KERNEL);
865 if (!iproc_i2c)
866 return -ENOMEM;
867
868 platform_set_drvdata(pdev, iproc_i2c);
869 iproc_i2c->device = &pdev->dev;
870 iproc_i2c->type =
> 871 (enum bcm_iproc_i2c_type)of_device_get_match_data(&pdev->dev);
872 init_completion(&iproc_i2c->done);
873
874 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
875 iproc_i2c->base = devm_ioremap_resource(iproc_i2c->device, res);
876 if (IS_ERR(iproc_i2c->base))
877 return PTR_ERR(iproc_i2c->base);
878
879 if (iproc_i2c->type == IPROC_I2C_NIC) {
880 res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
881 iproc_i2c->idm_base = devm_ioremap_resource(iproc_i2c->device,
882 res);
883 if (IS_ERR(iproc_i2c->idm_base))
884 return PTR_ERR(iproc_i2c->idm_base);
885
886 ret = of_property_read_u32(iproc_i2c->device->of_node,
887 "brcm,ape-hsls-addr-mask",
888 &iproc_i2c->ape_addr_mask);
889 if (ret < 0) {
890 dev_err(iproc_i2c->device,
891 "'brcm,ape-hsls-addr-mask' missing\n");
892 return -EINVAL;
893 }
894
895 spin_lock_init(&iproc_i2c->idm_lock);
896
897 /* no slave support */
898 bcm_iproc_algo.reg_slave = NULL;
899 bcm_iproc_algo.unreg_slave = NULL;
900 }
901
902 ret = bcm_iproc_i2c_init(iproc_i2c);
903 if (ret)
904 return ret;
905
906 ret = bcm_iproc_i2c_cfg_speed(iproc_i2c);
907 if (ret)
908 return ret;
909
910 irq = platform_get_irq(pdev, 0);
911 if (irq > 0) {
912 ret = devm_request_irq(iproc_i2c->device, irq,
913 bcm_iproc_i2c_isr, 0, pdev->name,
914 iproc_i2c);
915 if (ret < 0) {
916 dev_err(iproc_i2c->device,
917 "unable to request irq %i\n", irq);
918 return ret;
919 }
920
921 iproc_i2c->irq = irq;
922 } else {
923 dev_warn(iproc_i2c->device,
924 "no irq resource, falling back to poll mode\n");
925 }
926
927 bcm_iproc_i2c_enable_disable(iproc_i2c, true);
928
929 adap = &iproc_i2c->adapter;
930 i2c_set_adapdata(adap, iproc_i2c);
931 strlcpy(adap->name, "Broadcom iProc I2C adapter", sizeof(adap->name));
932 adap->algo = &bcm_iproc_algo;
933 adap->quirks = &bcm_iproc_i2c_quirks;
934 adap->dev.parent = &pdev->dev;
935 adap->dev.of_node = pdev->dev.of_node;
936
937 return i2c_add_adapter(adap);
938 }
939

--
0-DAY CI Kernel Test Service