drivers/i2c/busses/i2c-mxs.c:802:18: warning: cast to smaller integer type 'enum mxs_i2c_devtype' from 'const void *'

From: kernel test robot
Date: Tue Sep 28 2021 - 00:31:04 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 92477dd1faa650e50bd3bb35a6c0b8d09198cc35
commit: c32abd8b569144b20c9c9b6dd7232828c612452f i2c: mxs: Remove unneeded platform_device_id
date: 10 months ago
config: arm64-randconfig-r024-20210927 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project dc6e8dfdfe7efecfda318d43a06fae18b40eb498)
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 arm64 cross compiling tool for clang build
# apt-get install binutils-aarch64-linux-gnu
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=c32abd8b569144b20c9c9b6dd7232828c612452f
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout c32abd8b569144b20c9c9b6dd7232828c612452f
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 ARCH=arm64

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

All warnings (new ones prefixed by >>):

>> drivers/i2c/busses/i2c-mxs.c:802:18: warning: cast to smaller integer type 'enum mxs_i2c_devtype' from 'const void *' [-Wvoid-pointer-to-enum-cast]
i2c->dev_type = (enum mxs_i2c_devtype)of_device_get_match_data(&pdev->dev);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.


vim +802 drivers/i2c/busses/i2c-mxs.c

790
791 static int mxs_i2c_probe(struct platform_device *pdev)
792 {
793 struct device *dev = &pdev->dev;
794 struct mxs_i2c_dev *i2c;
795 struct i2c_adapter *adap;
796 int err, irq;
797
798 i2c = devm_kzalloc(dev, sizeof(*i2c), GFP_KERNEL);
799 if (!i2c)
800 return -ENOMEM;
801
> 802 i2c->dev_type = (enum mxs_i2c_devtype)of_device_get_match_data(&pdev->dev);
803
804 i2c->regs = devm_platform_ioremap_resource(pdev, 0);
805 if (IS_ERR(i2c->regs))
806 return PTR_ERR(i2c->regs);
807
808 irq = platform_get_irq(pdev, 0);
809 if (irq < 0)
810 return irq;
811
812 err = devm_request_irq(dev, irq, mxs_i2c_isr, 0, dev_name(dev), i2c);
813 if (err)
814 return err;
815
816 i2c->dev = dev;
817
818 init_completion(&i2c->cmd_complete);
819
820 if (dev->of_node) {
821 err = mxs_i2c_get_ofdata(i2c);
822 if (err)
823 return err;
824 }
825
826 /* Setup the DMA */
827 i2c->dmach = dma_request_chan(dev, "rx-tx");
828 if (IS_ERR(i2c->dmach)) {
829 dev_err(dev, "Failed to request dma\n");
830 return PTR_ERR(i2c->dmach);
831 }
832
833 platform_set_drvdata(pdev, i2c);
834
835 /* Do reset to enforce correct startup after pinmuxing */
836 err = mxs_i2c_reset(i2c);
837 if (err)
838 return err;
839
840 adap = &i2c->adapter;
841 strlcpy(adap->name, "MXS I2C adapter", sizeof(adap->name));
842 adap->owner = THIS_MODULE;
843 adap->algo = &mxs_i2c_algo;
844 adap->quirks = &mxs_i2c_quirks;
845 adap->dev.parent = dev;
846 adap->nr = pdev->id;
847 adap->dev.of_node = pdev->dev.of_node;
848 i2c_set_adapdata(adap, i2c);
849 err = i2c_add_numbered_adapter(adap);
850 if (err) {
851 writel(MXS_I2C_CTRL0_SFTRST,
852 i2c->regs + MXS_I2C_CTRL0_SET);
853 return err;
854 }
855
856 return 0;
857 }
858

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

Attachment: .config.gz
Description: application/gzip