All of lore.kernel.org
 help / color / mirror / Atom feed
* [wsa:coccinelle/of_device_get_match_data 11/19] drivers/mmc/host/meson-gx-mmc.c:1121:13: error: assigning to 'struct meson_mmc_data *' from 'const void *' discards qualifiers
@ 2021-09-19  1:35 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2021-09-19  1:35 UTC (permalink / raw)
  To: kbuild-all

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

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux.git coccinelle/of_device_get_match_data
head:   855d01e7ecabcc51ac572795173d15205ecc208b
commit: 7bdb4c9e750176e3306891fcce3d50f62dd97b68 [11/19] mmc: meson-gx-mmc: 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=7bdb4c9e750176e3306891fcce3d50f62dd97b68
        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 7bdb4c9e750176e3306891fcce3d50f62dd97b68
        # 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 <lkp@intel.com>

All errors (new ones prefixed by >>):

>> drivers/mmc/host/meson-gx-mmc.c:1121:13: error: assigning to 'struct meson_mmc_data *' from 'const void *' discards qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers]
           host->data = of_device_get_match_data(&pdev->dev);
                      ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   1 error generated.


vim +1121 drivers/mmc/host/meson-gx-mmc.c

  1088	
  1089	static int meson_mmc_probe(struct platform_device *pdev)
  1090	{
  1091		struct resource *res;
  1092		struct meson_host *host;
  1093		struct mmc_host *mmc;
  1094		int ret;
  1095	
  1096		mmc = mmc_alloc_host(sizeof(struct meson_host), &pdev->dev);
  1097		if (!mmc)
  1098			return -ENOMEM;
  1099		host = mmc_priv(mmc);
  1100		host->mmc = mmc;
  1101		host->dev = &pdev->dev;
  1102		dev_set_drvdata(&pdev->dev, host);
  1103	
  1104		/* The G12A SDIO Controller needs an SRAM bounce buffer */
  1105		host->dram_access_quirk = device_property_read_bool(&pdev->dev,
  1106						"amlogic,dram-access-quirk");
  1107	
  1108		/* Get regulators and the supported OCR mask */
  1109		host->vqmmc_enabled = false;
  1110		ret = mmc_regulator_get_supply(mmc);
  1111		if (ret)
  1112			goto free_host;
  1113	
  1114		ret = mmc_of_parse(mmc);
  1115		if (ret) {
  1116			if (ret != -EPROBE_DEFER)
  1117				dev_warn(&pdev->dev, "error parsing DT: %d\n", ret);
  1118			goto free_host;
  1119		}
  1120	
> 1121		host->data = of_device_get_match_data(&pdev->dev);
  1122		if (!host->data) {
  1123			ret = -EINVAL;
  1124			goto free_host;
  1125		}
  1126	
  1127		ret = device_reset_optional(&pdev->dev);
  1128		if (ret)
  1129			return dev_err_probe(&pdev->dev, ret, "device reset failed\n");
  1130	
  1131		res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
  1132		host->regs = devm_ioremap_resource(&pdev->dev, res);
  1133		if (IS_ERR(host->regs)) {
  1134			ret = PTR_ERR(host->regs);
  1135			goto free_host;
  1136		}
  1137	
  1138		host->irq = platform_get_irq(pdev, 0);
  1139		if (host->irq <= 0) {
  1140			ret = -EINVAL;
  1141			goto free_host;
  1142		}
  1143	
  1144		host->pinctrl = devm_pinctrl_get(&pdev->dev);
  1145		if (IS_ERR(host->pinctrl)) {
  1146			ret = PTR_ERR(host->pinctrl);
  1147			goto free_host;
  1148		}
  1149	
  1150		host->pins_clk_gate = pinctrl_lookup_state(host->pinctrl,
  1151							   "clk-gate");
  1152		if (IS_ERR(host->pins_clk_gate)) {
  1153			dev_warn(&pdev->dev,
  1154				 "can't get clk-gate pinctrl, using clk_stop bit\n");
  1155			host->pins_clk_gate = NULL;
  1156		}
  1157	
  1158		host->core_clk = devm_clk_get(&pdev->dev, "core");
  1159		if (IS_ERR(host->core_clk)) {
  1160			ret = PTR_ERR(host->core_clk);
  1161			goto free_host;
  1162		}
  1163	
  1164		ret = clk_prepare_enable(host->core_clk);
  1165		if (ret)
  1166			goto free_host;
  1167	
  1168		ret = meson_mmc_clk_init(host);
  1169		if (ret)
  1170			goto err_core_clk;
  1171	
  1172		/* set config to sane default */
  1173		meson_mmc_cfg_init(host);
  1174	
  1175		/* Stop execution */
  1176		writel(0, host->regs + SD_EMMC_START);
  1177	
  1178		/* clear, ack and enable interrupts */
  1179		writel(0, host->regs + SD_EMMC_IRQ_EN);
  1180		writel(IRQ_CRC_ERR | IRQ_TIMEOUTS | IRQ_END_OF_CHAIN,
  1181		       host->regs + SD_EMMC_STATUS);
  1182		writel(IRQ_CRC_ERR | IRQ_TIMEOUTS | IRQ_END_OF_CHAIN,
  1183		       host->regs + SD_EMMC_IRQ_EN);
  1184	
  1185		ret = request_threaded_irq(host->irq, meson_mmc_irq,
  1186					   meson_mmc_irq_thread, IRQF_ONESHOT,
  1187					   dev_name(&pdev->dev), host);
  1188		if (ret)
  1189			goto err_init_clk;
  1190	
  1191		mmc->caps |= MMC_CAP_CMD23;
  1192		if (host->dram_access_quirk) {
  1193			/* Limit segments to 1 due to low available sram memory */
  1194			mmc->max_segs = 1;
  1195			/* Limit to the available sram memory */
  1196			mmc->max_blk_count = SD_EMMC_SRAM_DATA_BUF_LEN /
  1197					     mmc->max_blk_size;
  1198		} else {
  1199			mmc->max_blk_count = CMD_CFG_LENGTH_MASK;
  1200			mmc->max_segs = SD_EMMC_DESC_BUF_LEN /
  1201					sizeof(struct sd_emmc_desc);
  1202		}
  1203		mmc->max_req_size = mmc->max_blk_count * mmc->max_blk_size;
  1204		mmc->max_seg_size = mmc->max_req_size;
  1205	
  1206		/*
  1207		 * At the moment, we don't know how to reliably enable HS400.
  1208		 * From the different datasheets, it is not even clear if this mode
  1209		 * is officially supported by any of the SoCs
  1210		 */
  1211		mmc->caps2 &= ~MMC_CAP2_HS400;
  1212	
  1213		if (host->dram_access_quirk) {
  1214			/*
  1215			 * The MMC Controller embeds 1,5KiB of internal SRAM
  1216			 * that can be used to be used as bounce buffer.
  1217			 * In the case of the G12A SDIO controller, use these
  1218			 * instead of the DDR memory
  1219			 */
  1220			host->bounce_buf_size = SD_EMMC_SRAM_DATA_BUF_LEN;
  1221			host->bounce_iomem_buf = host->regs + SD_EMMC_SRAM_DATA_BUF_OFF;
  1222			host->bounce_dma_addr = res->start + SD_EMMC_SRAM_DATA_BUF_OFF;
  1223		} else {
  1224			/* data bounce buffer */
  1225			host->bounce_buf_size = mmc->max_req_size;
  1226			host->bounce_buf =
  1227				dma_alloc_coherent(host->dev, host->bounce_buf_size,
  1228						   &host->bounce_dma_addr, GFP_KERNEL);
  1229			if (host->bounce_buf == NULL) {
  1230				dev_err(host->dev, "Unable to map allocate DMA bounce buffer.\n");
  1231				ret = -ENOMEM;
  1232				goto err_free_irq;
  1233			}
  1234		}
  1235	
  1236		host->descs = dma_alloc_coherent(host->dev, SD_EMMC_DESC_BUF_LEN,
  1237			      &host->descs_dma_addr, GFP_KERNEL);
  1238		if (!host->descs) {
  1239			dev_err(host->dev, "Allocating descriptor DMA buffer failed\n");
  1240			ret = -ENOMEM;
  1241			goto err_bounce_buf;
  1242		}
  1243	
  1244		mmc->ops = &meson_mmc_ops;
  1245		mmc_add_host(mmc);
  1246	
  1247		return 0;
  1248	
  1249	err_bounce_buf:
  1250		if (!host->dram_access_quirk)
  1251			dma_free_coherent(host->dev, host->bounce_buf_size,
  1252					  host->bounce_buf, host->bounce_dma_addr);
  1253	err_free_irq:
  1254		free_irq(host->irq, host);
  1255	err_init_clk:
  1256		clk_disable_unprepare(host->mmc_clk);
  1257	err_core_clk:
  1258		clk_disable_unprepare(host->core_clk);
  1259	free_host:
  1260		mmc_free_host(mmc);
  1261		return ret;
  1262	}
  1263	

---
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: 32868 bytes --]

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-09-19  1:35 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-19  1:35 [wsa:coccinelle/of_device_get_match_data 11/19] drivers/mmc/host/meson-gx-mmc.c:1121:13: error: assigning to 'struct meson_mmc_data *' from 'const void *' discards qualifiers kernel test robot

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.