tree: https://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux.git coccinelle/of_device_get_match_data head: 855d01e7ecabcc51ac572795173d15205ecc208b commit: 45aa38305042a32a2f154573d3f006788cbba3b0 [3/19] drm/arm/malidp: don't cast result of of_device_get_match_data() config: riscv-randconfig-r016-20210919 (attached as .config) compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project c8b3d7d6d6de37af68b2f379d0e37304f78e115f) 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 riscv cross compiling tool for clang build # apt-get install binutils-riscv64-linux-gnu # https://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux.git/commit/?id=45aa38305042a32a2f154573d3f006788cbba3b0 git remote add wsa https://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux.git git fetch --no-tags wsa coccinelle/of_device_get_match_data git checkout 45aa38305042a32a2f154573d3f006788cbba3b0 # save the attached .config to linux build tree COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 ARCH=riscv If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot All errors (new ones prefixed by >>): >> drivers/gpu/drm/arm/malidp_drv.c:727:12: error: assigning to 'struct malidp_hw *' from 'const void *' discards qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers] hwdev->hw = of_device_get_match_data(dev); ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1 error generated. vim +727 drivers/gpu/drm/arm/malidp_drv.c 704 705 static int malidp_bind(struct device *dev) 706 { 707 struct resource *res; 708 struct drm_device *drm; 709 struct malidp_drm *malidp; 710 struct malidp_hw_device *hwdev; 711 struct platform_device *pdev = to_platform_device(dev); 712 struct of_device_id const *dev_id; 713 struct drm_encoder *encoder; 714 /* number of lines for the R, G and B output */ 715 u8 output_width[MAX_OUTPUT_CHANNELS]; 716 int ret = 0, i; 717 u32 version, out_depth = 0; 718 719 malidp = devm_kzalloc(dev, sizeof(*malidp), GFP_KERNEL); 720 if (!malidp) 721 return -ENOMEM; 722 723 hwdev = devm_kzalloc(dev, sizeof(*hwdev), GFP_KERNEL); 724 if (!hwdev) 725 return -ENOMEM; 726 > 727 hwdev->hw = of_device_get_match_data(dev); 728 malidp->dev = hwdev; 729 730 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 731 hwdev->regs = devm_ioremap_resource(dev, res); 732 if (IS_ERR(hwdev->regs)) 733 return PTR_ERR(hwdev->regs); 734 735 hwdev->pclk = devm_clk_get(dev, "pclk"); 736 if (IS_ERR(hwdev->pclk)) 737 return PTR_ERR(hwdev->pclk); 738 739 hwdev->aclk = devm_clk_get(dev, "aclk"); 740 if (IS_ERR(hwdev->aclk)) 741 return PTR_ERR(hwdev->aclk); 742 743 hwdev->mclk = devm_clk_get(dev, "mclk"); 744 if (IS_ERR(hwdev->mclk)) 745 return PTR_ERR(hwdev->mclk); 746 747 hwdev->pxlclk = devm_clk_get(dev, "pxlclk"); 748 if (IS_ERR(hwdev->pxlclk)) 749 return PTR_ERR(hwdev->pxlclk); 750 751 /* Get the optional framebuffer memory resource */ 752 ret = of_reserved_mem_device_init(dev); 753 if (ret && ret != -ENODEV) 754 return ret; 755 756 drm = drm_dev_alloc(&malidp_driver, dev); 757 if (IS_ERR(drm)) { 758 ret = PTR_ERR(drm); 759 goto alloc_fail; 760 } 761 762 drm->dev_private = malidp; 763 dev_set_drvdata(dev, drm); 764 765 /* Enable power management */ 766 pm_runtime_enable(dev); 767 768 /* Resume device to enable the clocks */ 769 if (pm_runtime_enabled(dev)) 770 pm_runtime_get_sync(dev); 771 else 772 malidp_runtime_pm_resume(dev); 773 774 dev_id = of_match_device(malidp_drm_of_match, dev); 775 if (!dev_id) { 776 ret = -EINVAL; 777 goto query_hw_fail; 778 } 779 780 if (!malidp_has_sufficient_address_space(res, dev_id)) { 781 DRM_ERROR("Insufficient address space in device-tree.\n"); 782 ret = -EINVAL; 783 goto query_hw_fail; 784 } 785 786 if (!malidp_is_compatible_hw_id(hwdev, dev_id)) { 787 ret = -EINVAL; 788 goto query_hw_fail; 789 } 790 791 ret = hwdev->hw->query_hw(hwdev); 792 if (ret) { 793 DRM_ERROR("Invalid HW configuration\n"); 794 goto query_hw_fail; 795 } 796 797 version = malidp_hw_read(hwdev, hwdev->hw->map.dc_base + MALIDP_DE_CORE_ID); 798 DRM_INFO("found ARM Mali-DP%3x version r%dp%d\n", version >> 16, 799 (version >> 12) & 0xf, (version >> 8) & 0xf); 800 801 malidp->core_id = version; 802 803 ret = of_property_read_u32(dev->of_node, 804 "arm,malidp-arqos-value", 805 &hwdev->arqos_value); 806 if (ret) 807 hwdev->arqos_value = 0x0; 808 809 /* set the number of lines used for output of RGB data */ 810 ret = of_property_read_u8_array(dev->of_node, 811 "arm,malidp-output-port-lines", 812 output_width, MAX_OUTPUT_CHANNELS); 813 if (ret) 814 goto query_hw_fail; 815 816 for (i = 0; i < MAX_OUTPUT_CHANNELS; i++) 817 out_depth = (out_depth << 8) | (output_width[i] & 0xf); 818 malidp_hw_write(hwdev, out_depth, hwdev->hw->map.out_depth_base); 819 hwdev->output_color_depth = out_depth; 820 821 atomic_set(&malidp->config_valid, MALIDP_CONFIG_VALID_INIT); 822 init_waitqueue_head(&malidp->wq); 823 824 ret = malidp_init(drm); 825 if (ret < 0) 826 goto query_hw_fail; 827 828 /* Set the CRTC's port so that the encoder component can find it */ 829 malidp->crtc.port = of_graph_get_port_by_id(dev->of_node, 0); 830 831 ret = component_bind_all(dev, drm); 832 if (ret) { 833 DRM_ERROR("Failed to bind all components\n"); 834 goto bind_fail; 835 } 836 837 /* We expect to have a maximum of two encoders one for the actual 838 * display and a virtual one for the writeback connector 839 */ 840 WARN_ON(drm->mode_config.num_encoder > 2); 841 list_for_each_entry(encoder, &drm->mode_config.encoder_list, head) { 842 encoder->possible_clones = 843 (1 << drm->mode_config.num_encoder) - 1; 844 } 845 846 ret = malidp_irq_init(pdev); 847 if (ret < 0) 848 goto irq_init_fail; 849 850 ret = drm_vblank_init(drm, drm->mode_config.num_crtc); 851 if (ret < 0) { 852 DRM_ERROR("failed to initialise vblank\n"); 853 goto vblank_fail; 854 } 855 pm_runtime_put(dev); 856 857 drm_mode_config_reset(drm); 858 859 drm_kms_helper_poll_init(drm); 860 861 ret = drm_dev_register(drm, 0); 862 if (ret) 863 goto register_fail; 864 865 drm_fbdev_generic_setup(drm, 32); 866 867 return 0; 868 869 register_fail: 870 drm_kms_helper_poll_fini(drm); 871 pm_runtime_get_sync(dev); 872 vblank_fail: 873 malidp_se_irq_fini(hwdev); 874 malidp_de_irq_fini(hwdev); 875 irq_init_fail: 876 drm_atomic_helper_shutdown(drm); 877 component_unbind_all(dev, drm); 878 bind_fail: 879 of_node_put(malidp->crtc.port); 880 malidp->crtc.port = NULL; 881 malidp_fini(drm); 882 query_hw_fail: 883 pm_runtime_put(dev); 884 if (pm_runtime_enabled(dev)) 885 pm_runtime_disable(dev); 886 else 887 malidp_runtime_pm_suspend(dev); 888 drm->dev_private = NULL; 889 dev_set_drvdata(dev, NULL); 890 drm_dev_put(drm); 891 alloc_fail: 892 of_reserved_mem_device_release(dev); 893 894 return ret; 895 } 896 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org