All of lore.kernel.org
 help / color / mirror / Atom feed
* [linux-next:master 6953/13205] drivers/dma/imx-dma.c:1048:20: warning: cast to smaller integer type 'enum imx_dma_type' from 'const void
@ 2020-12-11 13:46 ` kernel test robot
  0 siblings, 0 replies; 10+ messages in thread
From: kernel test robot @ 2020-12-11 13:46 UTC (permalink / raw)
  To: Fabio Estevam
  Cc: kbuild-all, clang-built-linux, Linux Memory Management List, Vinod Koul

[-- Attachment #1: Type: text/plain, Size: 7678 bytes --]

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   3cc2bd440f2171f093b3a8480a4b54d8c270ed38
commit: 0ab785c894e618587e83bb67e8a8e96649868ad1 [6953/13205] dmaengine: imx-dma: Remove unused .id_table
config: arm64-randconfig-r012-20201211 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project 5ff35356f1af2bb92785b38c657463924d9ec386)
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/next/linux-next.git/commit/?id=0ab785c894e618587e83bb67e8a8e96649868ad1
        git remote add linux-next https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
        git fetch --no-tags linux-next master
        git checkout 0ab785c894e618587e83bb67e8a8e96649868ad1
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm64 

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

All warnings (new ones prefixed by >>):

>> drivers/dma/imx-dma.c:1048:20: warning: cast to smaller integer type 'enum imx_dma_type' from 'const void *' [-Wvoid-pointer-to-enum-cast]
           imxdma->devtype = (enum imx_dma_type)of_device_get_match_data(&pdev->dev);
                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   1 warning generated.

vim +1048 drivers/dma/imx-dma.c

  1035	
  1036	static int __init imxdma_probe(struct platform_device *pdev)
  1037	{
  1038		struct imxdma_engine *imxdma;
  1039		struct resource *res;
  1040		int ret, i;
  1041		int irq, irq_err;
  1042	
  1043		imxdma = devm_kzalloc(&pdev->dev, sizeof(*imxdma), GFP_KERNEL);
  1044		if (!imxdma)
  1045			return -ENOMEM;
  1046	
  1047		imxdma->dev = &pdev->dev;
> 1048		imxdma->devtype = (enum imx_dma_type)of_device_get_match_data(&pdev->dev);
  1049	
  1050		res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
  1051		imxdma->base = devm_ioremap_resource(&pdev->dev, res);
  1052		if (IS_ERR(imxdma->base))
  1053			return PTR_ERR(imxdma->base);
  1054	
  1055		irq = platform_get_irq(pdev, 0);
  1056		if (irq < 0)
  1057			return irq;
  1058	
  1059		imxdma->dma_ipg = devm_clk_get(&pdev->dev, "ipg");
  1060		if (IS_ERR(imxdma->dma_ipg))
  1061			return PTR_ERR(imxdma->dma_ipg);
  1062	
  1063		imxdma->dma_ahb = devm_clk_get(&pdev->dev, "ahb");
  1064		if (IS_ERR(imxdma->dma_ahb))
  1065			return PTR_ERR(imxdma->dma_ahb);
  1066	
  1067		ret = clk_prepare_enable(imxdma->dma_ipg);
  1068		if (ret)
  1069			return ret;
  1070		ret = clk_prepare_enable(imxdma->dma_ahb);
  1071		if (ret)
  1072			goto disable_dma_ipg_clk;
  1073	
  1074		/* reset DMA module */
  1075		imx_dmav1_writel(imxdma, DCR_DRST, DMA_DCR);
  1076	
  1077		if (is_imx1_dma(imxdma)) {
  1078			ret = devm_request_irq(&pdev->dev, irq,
  1079					       dma_irq_handler, 0, "DMA", imxdma);
  1080			if (ret) {
  1081				dev_warn(imxdma->dev, "Can't register IRQ for DMA\n");
  1082				goto disable_dma_ahb_clk;
  1083			}
  1084			imxdma->irq = irq;
  1085	
  1086			irq_err = platform_get_irq(pdev, 1);
  1087			if (irq_err < 0) {
  1088				ret = irq_err;
  1089				goto disable_dma_ahb_clk;
  1090			}
  1091	
  1092			ret = devm_request_irq(&pdev->dev, irq_err,
  1093					       imxdma_err_handler, 0, "DMA", imxdma);
  1094			if (ret) {
  1095				dev_warn(imxdma->dev, "Can't register ERRIRQ for DMA\n");
  1096				goto disable_dma_ahb_clk;
  1097			}
  1098			imxdma->irq_err = irq_err;
  1099		}
  1100	
  1101		/* enable DMA module */
  1102		imx_dmav1_writel(imxdma, DCR_DEN, DMA_DCR);
  1103	
  1104		/* clear all interrupts */
  1105		imx_dmav1_writel(imxdma, (1 << IMX_DMA_CHANNELS) - 1, DMA_DISR);
  1106	
  1107		/* disable interrupts */
  1108		imx_dmav1_writel(imxdma, (1 << IMX_DMA_CHANNELS) - 1, DMA_DIMR);
  1109	
  1110		INIT_LIST_HEAD(&imxdma->dma_device.channels);
  1111	
  1112		dma_cap_set(DMA_SLAVE, imxdma->dma_device.cap_mask);
  1113		dma_cap_set(DMA_CYCLIC, imxdma->dma_device.cap_mask);
  1114		dma_cap_set(DMA_MEMCPY, imxdma->dma_device.cap_mask);
  1115		dma_cap_set(DMA_INTERLEAVE, imxdma->dma_device.cap_mask);
  1116	
  1117		/* Initialize 2D global parameters */
  1118		for (i = 0; i < IMX_DMA_2D_SLOTS; i++)
  1119			imxdma->slots_2d[i].count = 0;
  1120	
  1121		spin_lock_init(&imxdma->lock);
  1122	
  1123		/* Initialize channel parameters */
  1124		for (i = 0; i < IMX_DMA_CHANNELS; i++) {
  1125			struct imxdma_channel *imxdmac = &imxdma->channel[i];
  1126	
  1127			if (!is_imx1_dma(imxdma)) {
  1128				ret = devm_request_irq(&pdev->dev, irq + i,
  1129						dma_irq_handler, 0, "DMA", imxdma);
  1130				if (ret) {
  1131					dev_warn(imxdma->dev, "Can't register IRQ %d "
  1132						 "for DMA channel %d\n",
  1133						 irq + i, i);
  1134					goto disable_dma_ahb_clk;
  1135				}
  1136	
  1137				imxdmac->irq = irq + i;
  1138				timer_setup(&imxdmac->watchdog, imxdma_watchdog, 0);
  1139			}
  1140	
  1141			imxdmac->imxdma = imxdma;
  1142	
  1143			INIT_LIST_HEAD(&imxdmac->ld_queue);
  1144			INIT_LIST_HEAD(&imxdmac->ld_free);
  1145			INIT_LIST_HEAD(&imxdmac->ld_active);
  1146	
  1147			tasklet_setup(&imxdmac->dma_tasklet, imxdma_tasklet);
  1148			imxdmac->chan.device = &imxdma->dma_device;
  1149			dma_cookie_init(&imxdmac->chan);
  1150			imxdmac->channel = i;
  1151	
  1152			/* Add the channel to the DMAC list */
  1153			list_add_tail(&imxdmac->chan.device_node,
  1154				      &imxdma->dma_device.channels);
  1155		}
  1156	
  1157		imxdma->dma_device.dev = &pdev->dev;
  1158	
  1159		imxdma->dma_device.device_alloc_chan_resources = imxdma_alloc_chan_resources;
  1160		imxdma->dma_device.device_free_chan_resources = imxdma_free_chan_resources;
  1161		imxdma->dma_device.device_tx_status = imxdma_tx_status;
  1162		imxdma->dma_device.device_prep_slave_sg = imxdma_prep_slave_sg;
  1163		imxdma->dma_device.device_prep_dma_cyclic = imxdma_prep_dma_cyclic;
  1164		imxdma->dma_device.device_prep_dma_memcpy = imxdma_prep_dma_memcpy;
  1165		imxdma->dma_device.device_prep_interleaved_dma = imxdma_prep_dma_interleaved;
  1166		imxdma->dma_device.device_config = imxdma_config;
  1167		imxdma->dma_device.device_terminate_all = imxdma_terminate_all;
  1168		imxdma->dma_device.device_issue_pending = imxdma_issue_pending;
  1169	
  1170		platform_set_drvdata(pdev, imxdma);
  1171	
  1172		imxdma->dma_device.copy_align = DMAENGINE_ALIGN_4_BYTES;
  1173		dma_set_max_seg_size(imxdma->dma_device.dev, 0xffffff);
  1174	
  1175		ret = dma_async_device_register(&imxdma->dma_device);
  1176		if (ret) {
  1177			dev_err(&pdev->dev, "unable to register\n");
  1178			goto disable_dma_ahb_clk;
  1179		}
  1180	
  1181		if (pdev->dev.of_node) {
  1182			ret = of_dma_controller_register(pdev->dev.of_node,
  1183					imxdma_xlate, imxdma);
  1184			if (ret) {
  1185				dev_err(&pdev->dev, "unable to register of_dma_controller\n");
  1186				goto err_of_dma_controller;
  1187			}
  1188		}
  1189	
  1190		return 0;
  1191	
  1192	err_of_dma_controller:
  1193		dma_async_device_unregister(&imxdma->dma_device);
  1194	disable_dma_ahb_clk:
  1195		clk_disable_unprepare(imxdma->dma_ahb);
  1196	disable_dma_ipg_clk:
  1197		clk_disable_unprepare(imxdma->dma_ipg);
  1198		return ret;
  1199	}
  1200	

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

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 34676 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [linux-next:master 6953/13205] drivers/dma/imx-dma.c:1048:20: warning: cast to smaller integer type 'enum imx_dma_type' from 'const void
@ 2020-12-11 13:46 ` kernel test robot
  0 siblings, 0 replies; 10+ messages in thread
From: kernel test robot @ 2020-12-11 13:46 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 7879 bytes --]

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   3cc2bd440f2171f093b3a8480a4b54d8c270ed38
commit: 0ab785c894e618587e83bb67e8a8e96649868ad1 [6953/13205] dmaengine: imx-dma: Remove unused .id_table
config: arm64-randconfig-r012-20201211 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project 5ff35356f1af2bb92785b38c657463924d9ec386)
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/next/linux-next.git/commit/?id=0ab785c894e618587e83bb67e8a8e96649868ad1
        git remote add linux-next https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
        git fetch --no-tags linux-next master
        git checkout 0ab785c894e618587e83bb67e8a8e96649868ad1
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm64 

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

All warnings (new ones prefixed by >>):

>> drivers/dma/imx-dma.c:1048:20: warning: cast to smaller integer type 'enum imx_dma_type' from 'const void *' [-Wvoid-pointer-to-enum-cast]
           imxdma->devtype = (enum imx_dma_type)of_device_get_match_data(&pdev->dev);
                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   1 warning generated.

vim +1048 drivers/dma/imx-dma.c

  1035	
  1036	static int __init imxdma_probe(struct platform_device *pdev)
  1037	{
  1038		struct imxdma_engine *imxdma;
  1039		struct resource *res;
  1040		int ret, i;
  1041		int irq, irq_err;
  1042	
  1043		imxdma = devm_kzalloc(&pdev->dev, sizeof(*imxdma), GFP_KERNEL);
  1044		if (!imxdma)
  1045			return -ENOMEM;
  1046	
  1047		imxdma->dev = &pdev->dev;
> 1048		imxdma->devtype = (enum imx_dma_type)of_device_get_match_data(&pdev->dev);
  1049	
  1050		res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
  1051		imxdma->base = devm_ioremap_resource(&pdev->dev, res);
  1052		if (IS_ERR(imxdma->base))
  1053			return PTR_ERR(imxdma->base);
  1054	
  1055		irq = platform_get_irq(pdev, 0);
  1056		if (irq < 0)
  1057			return irq;
  1058	
  1059		imxdma->dma_ipg = devm_clk_get(&pdev->dev, "ipg");
  1060		if (IS_ERR(imxdma->dma_ipg))
  1061			return PTR_ERR(imxdma->dma_ipg);
  1062	
  1063		imxdma->dma_ahb = devm_clk_get(&pdev->dev, "ahb");
  1064		if (IS_ERR(imxdma->dma_ahb))
  1065			return PTR_ERR(imxdma->dma_ahb);
  1066	
  1067		ret = clk_prepare_enable(imxdma->dma_ipg);
  1068		if (ret)
  1069			return ret;
  1070		ret = clk_prepare_enable(imxdma->dma_ahb);
  1071		if (ret)
  1072			goto disable_dma_ipg_clk;
  1073	
  1074		/* reset DMA module */
  1075		imx_dmav1_writel(imxdma, DCR_DRST, DMA_DCR);
  1076	
  1077		if (is_imx1_dma(imxdma)) {
  1078			ret = devm_request_irq(&pdev->dev, irq,
  1079					       dma_irq_handler, 0, "DMA", imxdma);
  1080			if (ret) {
  1081				dev_warn(imxdma->dev, "Can't register IRQ for DMA\n");
  1082				goto disable_dma_ahb_clk;
  1083			}
  1084			imxdma->irq = irq;
  1085	
  1086			irq_err = platform_get_irq(pdev, 1);
  1087			if (irq_err < 0) {
  1088				ret = irq_err;
  1089				goto disable_dma_ahb_clk;
  1090			}
  1091	
  1092			ret = devm_request_irq(&pdev->dev, irq_err,
  1093					       imxdma_err_handler, 0, "DMA", imxdma);
  1094			if (ret) {
  1095				dev_warn(imxdma->dev, "Can't register ERRIRQ for DMA\n");
  1096				goto disable_dma_ahb_clk;
  1097			}
  1098			imxdma->irq_err = irq_err;
  1099		}
  1100	
  1101		/* enable DMA module */
  1102		imx_dmav1_writel(imxdma, DCR_DEN, DMA_DCR);
  1103	
  1104		/* clear all interrupts */
  1105		imx_dmav1_writel(imxdma, (1 << IMX_DMA_CHANNELS) - 1, DMA_DISR);
  1106	
  1107		/* disable interrupts */
  1108		imx_dmav1_writel(imxdma, (1 << IMX_DMA_CHANNELS) - 1, DMA_DIMR);
  1109	
  1110		INIT_LIST_HEAD(&imxdma->dma_device.channels);
  1111	
  1112		dma_cap_set(DMA_SLAVE, imxdma->dma_device.cap_mask);
  1113		dma_cap_set(DMA_CYCLIC, imxdma->dma_device.cap_mask);
  1114		dma_cap_set(DMA_MEMCPY, imxdma->dma_device.cap_mask);
  1115		dma_cap_set(DMA_INTERLEAVE, imxdma->dma_device.cap_mask);
  1116	
  1117		/* Initialize 2D global parameters */
  1118		for (i = 0; i < IMX_DMA_2D_SLOTS; i++)
  1119			imxdma->slots_2d[i].count = 0;
  1120	
  1121		spin_lock_init(&imxdma->lock);
  1122	
  1123		/* Initialize channel parameters */
  1124		for (i = 0; i < IMX_DMA_CHANNELS; i++) {
  1125			struct imxdma_channel *imxdmac = &imxdma->channel[i];
  1126	
  1127			if (!is_imx1_dma(imxdma)) {
  1128				ret = devm_request_irq(&pdev->dev, irq + i,
  1129						dma_irq_handler, 0, "DMA", imxdma);
  1130				if (ret) {
  1131					dev_warn(imxdma->dev, "Can't register IRQ %d "
  1132						 "for DMA channel %d\n",
  1133						 irq + i, i);
  1134					goto disable_dma_ahb_clk;
  1135				}
  1136	
  1137				imxdmac->irq = irq + i;
  1138				timer_setup(&imxdmac->watchdog, imxdma_watchdog, 0);
  1139			}
  1140	
  1141			imxdmac->imxdma = imxdma;
  1142	
  1143			INIT_LIST_HEAD(&imxdmac->ld_queue);
  1144			INIT_LIST_HEAD(&imxdmac->ld_free);
  1145			INIT_LIST_HEAD(&imxdmac->ld_active);
  1146	
  1147			tasklet_setup(&imxdmac->dma_tasklet, imxdma_tasklet);
  1148			imxdmac->chan.device = &imxdma->dma_device;
  1149			dma_cookie_init(&imxdmac->chan);
  1150			imxdmac->channel = i;
  1151	
  1152			/* Add the channel to the DMAC list */
  1153			list_add_tail(&imxdmac->chan.device_node,
  1154				      &imxdma->dma_device.channels);
  1155		}
  1156	
  1157		imxdma->dma_device.dev = &pdev->dev;
  1158	
  1159		imxdma->dma_device.device_alloc_chan_resources = imxdma_alloc_chan_resources;
  1160		imxdma->dma_device.device_free_chan_resources = imxdma_free_chan_resources;
  1161		imxdma->dma_device.device_tx_status = imxdma_tx_status;
  1162		imxdma->dma_device.device_prep_slave_sg = imxdma_prep_slave_sg;
  1163		imxdma->dma_device.device_prep_dma_cyclic = imxdma_prep_dma_cyclic;
  1164		imxdma->dma_device.device_prep_dma_memcpy = imxdma_prep_dma_memcpy;
  1165		imxdma->dma_device.device_prep_interleaved_dma = imxdma_prep_dma_interleaved;
  1166		imxdma->dma_device.device_config = imxdma_config;
  1167		imxdma->dma_device.device_terminate_all = imxdma_terminate_all;
  1168		imxdma->dma_device.device_issue_pending = imxdma_issue_pending;
  1169	
  1170		platform_set_drvdata(pdev, imxdma);
  1171	
  1172		imxdma->dma_device.copy_align = DMAENGINE_ALIGN_4_BYTES;
  1173		dma_set_max_seg_size(imxdma->dma_device.dev, 0xffffff);
  1174	
  1175		ret = dma_async_device_register(&imxdma->dma_device);
  1176		if (ret) {
  1177			dev_err(&pdev->dev, "unable to register\n");
  1178			goto disable_dma_ahb_clk;
  1179		}
  1180	
  1181		if (pdev->dev.of_node) {
  1182			ret = of_dma_controller_register(pdev->dev.of_node,
  1183					imxdma_xlate, imxdma);
  1184			if (ret) {
  1185				dev_err(&pdev->dev, "unable to register of_dma_controller\n");
  1186				goto err_of_dma_controller;
  1187			}
  1188		}
  1189	
  1190		return 0;
  1191	
  1192	err_of_dma_controller:
  1193		dma_async_device_unregister(&imxdma->dma_device);
  1194	disable_dma_ahb_clk:
  1195		clk_disable_unprepare(imxdma->dma_ahb);
  1196	disable_dma_ipg_clk:
  1197		clk_disable_unprepare(imxdma->dma_ipg);
  1198		return ret;
  1199	}
  1200	

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

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 34676 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [linux-next:master 6953/13205] drivers/dma/imx-dma.c:1048:20: warning: cast to smaller integer type 'enum imx_dma_type' from 'const void
  2020-12-11 13:46 ` kernel test robot
@ 2020-12-11 14:54   ` Souptick Joarder
  -1 siblings, 0 replies; 10+ messages in thread
From: Souptick Joarder @ 2020-12-11 14:54 UTC (permalink / raw)
  To: kernel test robot
  Cc: Fabio Estevam, kbuild-all, clang-built-linux,
	Linux Memory Management List, Vinod Koul

On Fri, Dec 11, 2020 at 7:17 PM kernel test robot <lkp@intel.com> wrote:
>
> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
> head:   3cc2bd440f2171f093b3a8480a4b54d8c270ed38
> commit: 0ab785c894e618587e83bb67e8a8e96649868ad1 [6953/13205] dmaengine: imx-dma: Remove unused .id_table
> config: arm64-randconfig-r012-20201211 (attached as .config)
> compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project 5ff35356f1af2bb92785b38c657463924d9ec386)
> 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/next/linux-next.git/commit/?id=0ab785c894e618587e83bb67e8a8e96649868ad1
>         git remote add linux-next https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
>         git fetch --no-tags linux-next master
>         git checkout 0ab785c894e618587e83bb67e8a8e96649868ad1
>         # save the attached .config to linux build tree
>         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm64
>
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot <lkp@intel.com>
>
> All warnings (new ones prefixed by >>):
>
> >> drivers/dma/imx-dma.c:1048:20: warning: cast to smaller integer type 'enum imx_dma_type' from 'const void *' [-Wvoid-pointer-to-enum-cast]
>            imxdma->devtype = (enum imx_dma_type)of_device_get_match_data(&pdev->dev);
>                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>    1 warning generated.
>
> vim +1048 drivers/dma/imx-dma.c
>
>   1035
>   1036  static int __init imxdma_probe(struct platform_device *pdev)
>   1037  {
>   1038          struct imxdma_engine *imxdma;
>   1039          struct resource *res;
>   1040          int ret, i;
>   1041          int irq, irq_err;
>   1042
>   1043          imxdma = devm_kzalloc(&pdev->dev, sizeof(*imxdma), GFP_KERNEL);
>   1044          if (!imxdma)
>   1045                  return -ENOMEM;
>   1046
>   1047          imxdma->dev = &pdev->dev;
> > 1048          imxdma->devtype = (enum imx_dma_type)of_device_get_match_data(&pdev->dev);

of_device_get_match_data() returns void * which is assigned to enum
imx_dma_type type without extracting
the value. Anything wrong with the previous assignment ?

- imxdma->devtype = pdev->id_entry->driver_data;


>   1049
>   1050          res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>   1051          imxdma->base = devm_ioremap_resource(&pdev->dev, res);
>   1052          if (IS_ERR(imxdma->base))
>   1053                  return PTR_ERR(imxdma->base);
>   1054
>   1055          irq = platform_get_irq(pdev, 0);
>   1056          if (irq < 0)
>   1057                  return irq;
>   1058
>   1059          imxdma->dma_ipg = devm_clk_get(&pdev->dev, "ipg");
>   1060          if (IS_ERR(imxdma->dma_ipg))
>   1061                  return PTR_ERR(imxdma->dma_ipg);
>   1062
>   1063          imxdma->dma_ahb = devm_clk_get(&pdev->dev, "ahb");
>   1064          if (IS_ERR(imxdma->dma_ahb))
>   1065                  return PTR_ERR(imxdma->dma_ahb);
>   1066
>   1067          ret = clk_prepare_enable(imxdma->dma_ipg);
>   1068          if (ret)
>   1069                  return ret;
>   1070          ret = clk_prepare_enable(imxdma->dma_ahb);
>   1071          if (ret)
>   1072                  goto disable_dma_ipg_clk;
>   1073
>   1074          /* reset DMA module */
>   1075          imx_dmav1_writel(imxdma, DCR_DRST, DMA_DCR);
>   1076
>   1077          if (is_imx1_dma(imxdma)) {
>   1078                  ret = devm_request_irq(&pdev->dev, irq,
>   1079                                         dma_irq_handler, 0, "DMA", imxdma);
>   1080                  if (ret) {
>   1081                          dev_warn(imxdma->dev, "Can't register IRQ for DMA\n");
>   1082                          goto disable_dma_ahb_clk;
>   1083                  }
>   1084                  imxdma->irq = irq;
>   1085
>   1086                  irq_err = platform_get_irq(pdev, 1);
>   1087                  if (irq_err < 0) {
>   1088                          ret = irq_err;
>   1089                          goto disable_dma_ahb_clk;
>   1090                  }
>   1091
>   1092                  ret = devm_request_irq(&pdev->dev, irq_err,
>   1093                                         imxdma_err_handler, 0, "DMA", imxdma);
>   1094                  if (ret) {
>   1095                          dev_warn(imxdma->dev, "Can't register ERRIRQ for DMA\n");
>   1096                          goto disable_dma_ahb_clk;
>   1097                  }
>   1098                  imxdma->irq_err = irq_err;
>   1099          }
>   1100
>   1101          /* enable DMA module */
>   1102          imx_dmav1_writel(imxdma, DCR_DEN, DMA_DCR);
>   1103
>   1104          /* clear all interrupts */
>   1105          imx_dmav1_writel(imxdma, (1 << IMX_DMA_CHANNELS) - 1, DMA_DISR);
>   1106
>   1107          /* disable interrupts */
>   1108          imx_dmav1_writel(imxdma, (1 << IMX_DMA_CHANNELS) - 1, DMA_DIMR);
>   1109
>   1110          INIT_LIST_HEAD(&imxdma->dma_device.channels);
>   1111
>   1112          dma_cap_set(DMA_SLAVE, imxdma->dma_device.cap_mask);
>   1113          dma_cap_set(DMA_CYCLIC, imxdma->dma_device.cap_mask);
>   1114          dma_cap_set(DMA_MEMCPY, imxdma->dma_device.cap_mask);
>   1115          dma_cap_set(DMA_INTERLEAVE, imxdma->dma_device.cap_mask);
>   1116
>   1117          /* Initialize 2D global parameters */
>   1118          for (i = 0; i < IMX_DMA_2D_SLOTS; i++)
>   1119                  imxdma->slots_2d[i].count = 0;
>   1120
>   1121          spin_lock_init(&imxdma->lock);
>   1122
>   1123          /* Initialize channel parameters */
>   1124          for (i = 0; i < IMX_DMA_CHANNELS; i++) {
>   1125                  struct imxdma_channel *imxdmac = &imxdma->channel[i];
>   1126
>   1127                  if (!is_imx1_dma(imxdma)) {
>   1128                          ret = devm_request_irq(&pdev->dev, irq + i,
>   1129                                          dma_irq_handler, 0, "DMA", imxdma);
>   1130                          if (ret) {
>   1131                                  dev_warn(imxdma->dev, "Can't register IRQ %d "
>   1132                                           "for DMA channel %d\n",
>   1133                                           irq + i, i);
>   1134                                  goto disable_dma_ahb_clk;
>   1135                          }
>   1136
>   1137                          imxdmac->irq = irq + i;
>   1138                          timer_setup(&imxdmac->watchdog, imxdma_watchdog, 0);
>   1139                  }
>   1140
>   1141                  imxdmac->imxdma = imxdma;
>   1142
>   1143                  INIT_LIST_HEAD(&imxdmac->ld_queue);
>   1144                  INIT_LIST_HEAD(&imxdmac->ld_free);
>   1145                  INIT_LIST_HEAD(&imxdmac->ld_active);
>   1146
>   1147                  tasklet_setup(&imxdmac->dma_tasklet, imxdma_tasklet);
>   1148                  imxdmac->chan.device = &imxdma->dma_device;
>   1149                  dma_cookie_init(&imxdmac->chan);
>   1150                  imxdmac->channel = i;
>   1151
>   1152                  /* Add the channel to the DMAC list */
>   1153                  list_add_tail(&imxdmac->chan.device_node,
>   1154                                &imxdma->dma_device.channels);
>   1155          }
>   1156
>   1157          imxdma->dma_device.dev = &pdev->dev;
>   1158
>   1159          imxdma->dma_device.device_alloc_chan_resources = imxdma_alloc_chan_resources;
>   1160          imxdma->dma_device.device_free_chan_resources = imxdma_free_chan_resources;
>   1161          imxdma->dma_device.device_tx_status = imxdma_tx_status;
>   1162          imxdma->dma_device.device_prep_slave_sg = imxdma_prep_slave_sg;
>   1163          imxdma->dma_device.device_prep_dma_cyclic = imxdma_prep_dma_cyclic;
>   1164          imxdma->dma_device.device_prep_dma_memcpy = imxdma_prep_dma_memcpy;
>   1165          imxdma->dma_device.device_prep_interleaved_dma = imxdma_prep_dma_interleaved;
>   1166          imxdma->dma_device.device_config = imxdma_config;
>   1167          imxdma->dma_device.device_terminate_all = imxdma_terminate_all;
>   1168          imxdma->dma_device.device_issue_pending = imxdma_issue_pending;
>   1169
>   1170          platform_set_drvdata(pdev, imxdma);
>   1171
>   1172          imxdma->dma_device.copy_align = DMAENGINE_ALIGN_4_BYTES;
>   1173          dma_set_max_seg_size(imxdma->dma_device.dev, 0xffffff);
>   1174
>   1175          ret = dma_async_device_register(&imxdma->dma_device);
>   1176          if (ret) {
>   1177                  dev_err(&pdev->dev, "unable to register\n");
>   1178                  goto disable_dma_ahb_clk;
>   1179          }
>   1180
>   1181          if (pdev->dev.of_node) {
>   1182                  ret = of_dma_controller_register(pdev->dev.of_node,
>   1183                                  imxdma_xlate, imxdma);
>   1184                  if (ret) {
>   1185                          dev_err(&pdev->dev, "unable to register of_dma_controller\n");
>   1186                          goto err_of_dma_controller;
>   1187                  }
>   1188          }
>   1189
>   1190          return 0;
>   1191
>   1192  err_of_dma_controller:
>   1193          dma_async_device_unregister(&imxdma->dma_device);
>   1194  disable_dma_ahb_clk:
>   1195          clk_disable_unprepare(imxdma->dma_ahb);
>   1196  disable_dma_ipg_clk:
>   1197          clk_disable_unprepare(imxdma->dma_ipg);
>   1198          return ret;
>   1199  }
>   1200
>
> ---
> 0-DAY CI Kernel Test Service, Intel Corporation
> https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [linux-next:master 6953/13205] drivers/dma/imx-dma.c:1048:20: warning: cast to smaller integer type 'enum imx_dma_type' from 'const void
@ 2020-12-11 14:54   ` Souptick Joarder
  0 siblings, 0 replies; 10+ messages in thread
From: Souptick Joarder @ 2020-12-11 14:54 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 10183 bytes --]

On Fri, Dec 11, 2020 at 7:17 PM kernel test robot <lkp@intel.com> wrote:
>
> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
> head:   3cc2bd440f2171f093b3a8480a4b54d8c270ed38
> commit: 0ab785c894e618587e83bb67e8a8e96649868ad1 [6953/13205] dmaengine: imx-dma: Remove unused .id_table
> config: arm64-randconfig-r012-20201211 (attached as .config)
> compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project 5ff35356f1af2bb92785b38c657463924d9ec386)
> 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/next/linux-next.git/commit/?id=0ab785c894e618587e83bb67e8a8e96649868ad1
>         git remote add linux-next https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
>         git fetch --no-tags linux-next master
>         git checkout 0ab785c894e618587e83bb67e8a8e96649868ad1
>         # save the attached .config to linux build tree
>         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm64
>
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot <lkp@intel.com>
>
> All warnings (new ones prefixed by >>):
>
> >> drivers/dma/imx-dma.c:1048:20: warning: cast to smaller integer type 'enum imx_dma_type' from 'const void *' [-Wvoid-pointer-to-enum-cast]
>            imxdma->devtype = (enum imx_dma_type)of_device_get_match_data(&pdev->dev);
>                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>    1 warning generated.
>
> vim +1048 drivers/dma/imx-dma.c
>
>   1035
>   1036  static int __init imxdma_probe(struct platform_device *pdev)
>   1037  {
>   1038          struct imxdma_engine *imxdma;
>   1039          struct resource *res;
>   1040          int ret, i;
>   1041          int irq, irq_err;
>   1042
>   1043          imxdma = devm_kzalloc(&pdev->dev, sizeof(*imxdma), GFP_KERNEL);
>   1044          if (!imxdma)
>   1045                  return -ENOMEM;
>   1046
>   1047          imxdma->dev = &pdev->dev;
> > 1048          imxdma->devtype = (enum imx_dma_type)of_device_get_match_data(&pdev->dev);

of_device_get_match_data() returns void * which is assigned to enum
imx_dma_type type without extracting
the value. Anything wrong with the previous assignment ?

- imxdma->devtype = pdev->id_entry->driver_data;


>   1049
>   1050          res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>   1051          imxdma->base = devm_ioremap_resource(&pdev->dev, res);
>   1052          if (IS_ERR(imxdma->base))
>   1053                  return PTR_ERR(imxdma->base);
>   1054
>   1055          irq = platform_get_irq(pdev, 0);
>   1056          if (irq < 0)
>   1057                  return irq;
>   1058
>   1059          imxdma->dma_ipg = devm_clk_get(&pdev->dev, "ipg");
>   1060          if (IS_ERR(imxdma->dma_ipg))
>   1061                  return PTR_ERR(imxdma->dma_ipg);
>   1062
>   1063          imxdma->dma_ahb = devm_clk_get(&pdev->dev, "ahb");
>   1064          if (IS_ERR(imxdma->dma_ahb))
>   1065                  return PTR_ERR(imxdma->dma_ahb);
>   1066
>   1067          ret = clk_prepare_enable(imxdma->dma_ipg);
>   1068          if (ret)
>   1069                  return ret;
>   1070          ret = clk_prepare_enable(imxdma->dma_ahb);
>   1071          if (ret)
>   1072                  goto disable_dma_ipg_clk;
>   1073
>   1074          /* reset DMA module */
>   1075          imx_dmav1_writel(imxdma, DCR_DRST, DMA_DCR);
>   1076
>   1077          if (is_imx1_dma(imxdma)) {
>   1078                  ret = devm_request_irq(&pdev->dev, irq,
>   1079                                         dma_irq_handler, 0, "DMA", imxdma);
>   1080                  if (ret) {
>   1081                          dev_warn(imxdma->dev, "Can't register IRQ for DMA\n");
>   1082                          goto disable_dma_ahb_clk;
>   1083                  }
>   1084                  imxdma->irq = irq;
>   1085
>   1086                  irq_err = platform_get_irq(pdev, 1);
>   1087                  if (irq_err < 0) {
>   1088                          ret = irq_err;
>   1089                          goto disable_dma_ahb_clk;
>   1090                  }
>   1091
>   1092                  ret = devm_request_irq(&pdev->dev, irq_err,
>   1093                                         imxdma_err_handler, 0, "DMA", imxdma);
>   1094                  if (ret) {
>   1095                          dev_warn(imxdma->dev, "Can't register ERRIRQ for DMA\n");
>   1096                          goto disable_dma_ahb_clk;
>   1097                  }
>   1098                  imxdma->irq_err = irq_err;
>   1099          }
>   1100
>   1101          /* enable DMA module */
>   1102          imx_dmav1_writel(imxdma, DCR_DEN, DMA_DCR);
>   1103
>   1104          /* clear all interrupts */
>   1105          imx_dmav1_writel(imxdma, (1 << IMX_DMA_CHANNELS) - 1, DMA_DISR);
>   1106
>   1107          /* disable interrupts */
>   1108          imx_dmav1_writel(imxdma, (1 << IMX_DMA_CHANNELS) - 1, DMA_DIMR);
>   1109
>   1110          INIT_LIST_HEAD(&imxdma->dma_device.channels);
>   1111
>   1112          dma_cap_set(DMA_SLAVE, imxdma->dma_device.cap_mask);
>   1113          dma_cap_set(DMA_CYCLIC, imxdma->dma_device.cap_mask);
>   1114          dma_cap_set(DMA_MEMCPY, imxdma->dma_device.cap_mask);
>   1115          dma_cap_set(DMA_INTERLEAVE, imxdma->dma_device.cap_mask);
>   1116
>   1117          /* Initialize 2D global parameters */
>   1118          for (i = 0; i < IMX_DMA_2D_SLOTS; i++)
>   1119                  imxdma->slots_2d[i].count = 0;
>   1120
>   1121          spin_lock_init(&imxdma->lock);
>   1122
>   1123          /* Initialize channel parameters */
>   1124          for (i = 0; i < IMX_DMA_CHANNELS; i++) {
>   1125                  struct imxdma_channel *imxdmac = &imxdma->channel[i];
>   1126
>   1127                  if (!is_imx1_dma(imxdma)) {
>   1128                          ret = devm_request_irq(&pdev->dev, irq + i,
>   1129                                          dma_irq_handler, 0, "DMA", imxdma);
>   1130                          if (ret) {
>   1131                                  dev_warn(imxdma->dev, "Can't register IRQ %d "
>   1132                                           "for DMA channel %d\n",
>   1133                                           irq + i, i);
>   1134                                  goto disable_dma_ahb_clk;
>   1135                          }
>   1136
>   1137                          imxdmac->irq = irq + i;
>   1138                          timer_setup(&imxdmac->watchdog, imxdma_watchdog, 0);
>   1139                  }
>   1140
>   1141                  imxdmac->imxdma = imxdma;
>   1142
>   1143                  INIT_LIST_HEAD(&imxdmac->ld_queue);
>   1144                  INIT_LIST_HEAD(&imxdmac->ld_free);
>   1145                  INIT_LIST_HEAD(&imxdmac->ld_active);
>   1146
>   1147                  tasklet_setup(&imxdmac->dma_tasklet, imxdma_tasklet);
>   1148                  imxdmac->chan.device = &imxdma->dma_device;
>   1149                  dma_cookie_init(&imxdmac->chan);
>   1150                  imxdmac->channel = i;
>   1151
>   1152                  /* Add the channel to the DMAC list */
>   1153                  list_add_tail(&imxdmac->chan.device_node,
>   1154                                &imxdma->dma_device.channels);
>   1155          }
>   1156
>   1157          imxdma->dma_device.dev = &pdev->dev;
>   1158
>   1159          imxdma->dma_device.device_alloc_chan_resources = imxdma_alloc_chan_resources;
>   1160          imxdma->dma_device.device_free_chan_resources = imxdma_free_chan_resources;
>   1161          imxdma->dma_device.device_tx_status = imxdma_tx_status;
>   1162          imxdma->dma_device.device_prep_slave_sg = imxdma_prep_slave_sg;
>   1163          imxdma->dma_device.device_prep_dma_cyclic = imxdma_prep_dma_cyclic;
>   1164          imxdma->dma_device.device_prep_dma_memcpy = imxdma_prep_dma_memcpy;
>   1165          imxdma->dma_device.device_prep_interleaved_dma = imxdma_prep_dma_interleaved;
>   1166          imxdma->dma_device.device_config = imxdma_config;
>   1167          imxdma->dma_device.device_terminate_all = imxdma_terminate_all;
>   1168          imxdma->dma_device.device_issue_pending = imxdma_issue_pending;
>   1169
>   1170          platform_set_drvdata(pdev, imxdma);
>   1171
>   1172          imxdma->dma_device.copy_align = DMAENGINE_ALIGN_4_BYTES;
>   1173          dma_set_max_seg_size(imxdma->dma_device.dev, 0xffffff);
>   1174
>   1175          ret = dma_async_device_register(&imxdma->dma_device);
>   1176          if (ret) {
>   1177                  dev_err(&pdev->dev, "unable to register\n");
>   1178                  goto disable_dma_ahb_clk;
>   1179          }
>   1180
>   1181          if (pdev->dev.of_node) {
>   1182                  ret = of_dma_controller_register(pdev->dev.of_node,
>   1183                                  imxdma_xlate, imxdma);
>   1184                  if (ret) {
>   1185                          dev_err(&pdev->dev, "unable to register of_dma_controller\n");
>   1186                          goto err_of_dma_controller;
>   1187                  }
>   1188          }
>   1189
>   1190          return 0;
>   1191
>   1192  err_of_dma_controller:
>   1193          dma_async_device_unregister(&imxdma->dma_device);
>   1194  disable_dma_ahb_clk:
>   1195          clk_disable_unprepare(imxdma->dma_ahb);
>   1196  disable_dma_ipg_clk:
>   1197          clk_disable_unprepare(imxdma->dma_ipg);
>   1198          return ret;
>   1199  }
>   1200
>
> ---
> 0-DAY CI Kernel Test Service, Intel Corporation
> https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [linux-next:master 6953/13205] drivers/dma/imx-dma.c:1048:20: warning: cast to smaller integer type 'enum imx_dma_type' from 'const void
  2020-12-11 14:54   ` Souptick Joarder
@ 2020-12-12 15:40     ` Fabio Estevam
  -1 siblings, 0 replies; 10+ messages in thread
From: Fabio Estevam @ 2020-12-12 15:40 UTC (permalink / raw)
  To: Souptick Joarder
  Cc: kernel test robot, kbuild-all, clang-built-linux,
	Linux Memory Management List, Vinod Koul

On Fri, Dec 11, 2020 at 11:54 AM Souptick Joarder <jrdr.linux@gmail.com> wrote:

> of_device_get_match_data() returns void * which is assigned to enum
> imx_dma_type type without extracting
> the value. Anything wrong with the previous assignment ?

The driver data is now passed via:
imxdma->devtype = (enum imx_dma_type)of_device_get_match_data(&pdev->dev);

There was nothing wrong with the previous assignment.

The original driver used to run on non-DT platforms. Now it only runs
on DT-platforms, which means we no longer need the platform data
structure.

Please note that this a W=1 clang warning. gcc does not complain about it.

Not sure how to make clang happy in this case.

The (enum ....)of_device_get_match_data() cast is widely used in the
kernel, so this is not specific usage in this driver.


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [linux-next:master 6953/13205] drivers/dma/imx-dma.c:1048:20: warning: cast to smaller integer type 'enum imx_dma_type' from 'const void
@ 2020-12-12 15:40     ` Fabio Estevam
  0 siblings, 0 replies; 10+ messages in thread
From: Fabio Estevam @ 2020-12-12 15:40 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 829 bytes --]

On Fri, Dec 11, 2020 at 11:54 AM Souptick Joarder <jrdr.linux@gmail.com> wrote:

> of_device_get_match_data() returns void * which is assigned to enum
> imx_dma_type type without extracting
> the value. Anything wrong with the previous assignment ?

The driver data is now passed via:
imxdma->devtype = (enum imx_dma_type)of_device_get_match_data(&pdev->dev);

There was nothing wrong with the previous assignment.

The original driver used to run on non-DT platforms. Now it only runs
on DT-platforms, which means we no longer need the platform data
structure.

Please note that this a W=1 clang warning. gcc does not complain about it.

Not sure how to make clang happy in this case.

The (enum ....)of_device_get_match_data() cast is widely used in the
kernel, so this is not specific usage in this driver.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [linux-next:master 6953/13205] drivers/dma/imx-dma.c:1048:20: warning: cast to smaller integer type 'enum imx_dma_type' from 'const void
  2020-12-12 15:40     ` Fabio Estevam
@ 2020-12-12 20:03       ` Nathan Chancellor
  -1 siblings, 0 replies; 10+ messages in thread
From: Nathan Chancellor @ 2020-12-12 20:03 UTC (permalink / raw)
  To: Fabio Estevam
  Cc: Souptick Joarder, kernel test robot, kbuild-all,
	clang-built-linux, Linux Memory Management List, Vinod Koul

On Sat, Dec 12, 2020 at 12:40:22PM -0300, Fabio Estevam wrote:
> On Fri, Dec 11, 2020 at 11:54 AM Souptick Joarder <jrdr.linux@gmail.com> wrote:
> 
> > of_device_get_match_data() returns void * which is assigned to enum
> > imx_dma_type type without extracting
> > the value. Anything wrong with the previous assignment ?
> 
> The driver data is now passed via:
> imxdma->devtype = (enum imx_dma_type)of_device_get_match_data(&pdev->dev);
> 
> There was nothing wrong with the previous assignment.
> 
> The original driver used to run on non-DT platforms. Now it only runs
> on DT-platforms, which means we no longer need the platform data
> structure.
> 
> Please note that this a W=1 clang warning. gcc does not complain about it.

Correct. The clang developers explicitly wanted this behavior so I moved
it under a new warning that could be disabled on regular builds but show
up on W=1 in case people wanted to fix these occurrences.

https://reviews.llvm.org/D72231
https://github.com/ClangBuiltLinux/linux/issues/887
82f2bc2fcc01 ("kbuild: Disable -Wpointer-to-enum-cast")

> Not sure how to make clang happy in this case.

Added a cast to unsigned long or uintptr_t before the cast to the enum
should fix it.

Cheers,
Nathan


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [linux-next:master 6953/13205] drivers/dma/imx-dma.c:1048:20: warning: cast to smaller integer type 'enum imx_dma_type' from 'const void
@ 2020-12-12 20:03       ` Nathan Chancellor
  0 siblings, 0 replies; 10+ messages in thread
From: Nathan Chancellor @ 2020-12-12 20:03 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 1263 bytes --]

On Sat, Dec 12, 2020 at 12:40:22PM -0300, Fabio Estevam wrote:
> On Fri, Dec 11, 2020 at 11:54 AM Souptick Joarder <jrdr.linux@gmail.com> wrote:
> 
> > of_device_get_match_data() returns void * which is assigned to enum
> > imx_dma_type type without extracting
> > the value. Anything wrong with the previous assignment ?
> 
> The driver data is now passed via:
> imxdma->devtype = (enum imx_dma_type)of_device_get_match_data(&pdev->dev);
> 
> There was nothing wrong with the previous assignment.
> 
> The original driver used to run on non-DT platforms. Now it only runs
> on DT-platforms, which means we no longer need the platform data
> structure.
> 
> Please note that this a W=1 clang warning. gcc does not complain about it.

Correct. The clang developers explicitly wanted this behavior so I moved
it under a new warning that could be disabled on regular builds but show
up on W=1 in case people wanted to fix these occurrences.

https://reviews.llvm.org/D72231
https://github.com/ClangBuiltLinux/linux/issues/887
82f2bc2fcc01 ("kbuild: Disable -Wpointer-to-enum-cast")

> Not sure how to make clang happy in this case.

Added a cast to unsigned long or uintptr_t before the cast to the enum
should fix it.

Cheers,
Nathan

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [linux-next:master 6953/13205] drivers/dma/imx-dma.c:1048:20: warning: cast to smaller integer type 'enum imx_dma_type' from 'const void
  2020-12-12 20:03       ` Nathan Chancellor
@ 2020-12-12 21:44         ` Fabio Estevam
  -1 siblings, 0 replies; 10+ messages in thread
From: Fabio Estevam @ 2020-12-12 21:44 UTC (permalink / raw)
  To: Nathan Chancellor
  Cc: Souptick Joarder, kernel test robot, kbuild-all,
	clang-built-linux, Linux Memory Management List, Vinod Koul

Hi Nathan,

On Sat, Dec 12, 2020 at 5:03 PM Nathan Chancellor
<natechancellor@gmail.com> wrote:

> Correct. The clang developers explicitly wanted this behavior so I moved
> it under a new warning that could be disabled on regular builds but show
> up on W=1 in case people wanted to fix these occurrences.
>
> https://reviews.llvm.org/D72231
> https://github.com/ClangBuiltLinux/linux/issues/887
> 82f2bc2fcc01 ("kbuild: Disable -Wpointer-to-enum-cast")
>
> > Not sure how to make clang happy in this case.

Thanks for the clarification.

> Added a cast to unsigned long or uintptr_t before the cast to the enum
> should fix it.

Great, thanks. Maybe someone could send patches fixing these W=1 clang
warnings for the different subsystems.

Regards,

Fabio Estevam


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [linux-next:master 6953/13205] drivers/dma/imx-dma.c:1048:20: warning: cast to smaller integer type 'enum imx_dma_type' from 'const void
@ 2020-12-12 21:44         ` Fabio Estevam
  0 siblings, 0 replies; 10+ messages in thread
From: Fabio Estevam @ 2020-12-12 21:44 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 790 bytes --]

Hi Nathan,

On Sat, Dec 12, 2020 at 5:03 PM Nathan Chancellor
<natechancellor@gmail.com> wrote:

> Correct. The clang developers explicitly wanted this behavior so I moved
> it under a new warning that could be disabled on regular builds but show
> up on W=1 in case people wanted to fix these occurrences.
>
> https://reviews.llvm.org/D72231
> https://github.com/ClangBuiltLinux/linux/issues/887
> 82f2bc2fcc01 ("kbuild: Disable -Wpointer-to-enum-cast")
>
> > Not sure how to make clang happy in this case.

Thanks for the clarification.

> Added a cast to unsigned long or uintptr_t before the cast to the enum
> should fix it.

Great, thanks. Maybe someone could send patches fixing these W=1 clang
warnings for the different subsystems.

Regards,

Fabio Estevam

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2020-12-12 21:45 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-11 13:46 [linux-next:master 6953/13205] drivers/dma/imx-dma.c:1048:20: warning: cast to smaller integer type 'enum imx_dma_type' from 'const void kernel test robot
2020-12-11 13:46 ` kernel test robot
2020-12-11 14:54 ` Souptick Joarder
2020-12-11 14:54   ` Souptick Joarder
2020-12-12 15:40   ` Fabio Estevam
2020-12-12 15:40     ` Fabio Estevam
2020-12-12 20:03     ` Nathan Chancellor
2020-12-12 20:03       ` Nathan Chancellor
2020-12-12 21:44       ` Fabio Estevam
2020-12-12 21:44         ` Fabio Estevam

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.