From: kernel test robot <lkp@intel.com>
To: oe-kbuild@lists.linux.dev
Cc: lkp@intel.com, Dan Carpenter <error27@gmail.com>
Subject: drivers/iommu/mtk_iommu_v1.c:487 mtk_iommu_v1_probe_device() error: we previously assumed 'fwspec' could be null (see line 465)
Date: Thu, 17 Oct 2024 09:14:12 +0800 [thread overview]
Message-ID: <202410170948.gfVfAuei-lkp@intel.com> (raw)
BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
CC: linux-kernel@vger.kernel.org
TO: Robin Murphy <robin.murphy@arm.com>
CC: Joerg Roedel <jroedel@suse.de>
CC: Jason Gunthorpe <jgg@nvidia.com>
CC: Jerry Snitselaar <jsnitsel@redhat.com>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: c964ced7726294d40913f2127c3f185a92cb4a41
commit: e7080665c977ea1aafb8547a9c7bd08b199311d6 iommu: Clean up open-coded ownership checks
date: 11 months ago
:::::: branch date: 4 hours ago
:::::: commit date: 11 months ago
config: arm-randconfig-r072-20241016 (https://download.01.org/0day-ci/archive/20241017/202410170948.gfVfAuei-lkp@intel.com/config)
compiler: arm-linux-gnueabi-gcc (GCC) 14.1.0
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>
| Reported-by: Dan Carpenter <error27@gmail.com>
| Closes: https://lore.kernel.org/r/202410170948.gfVfAuei-lkp@intel.com/
smatch warnings:
drivers/iommu/mtk_iommu_v1.c:487 mtk_iommu_v1_probe_device() error: we previously assumed 'fwspec' could be null (see line 465)
vim +/fwspec +487 drivers/iommu/mtk_iommu_v1.c
b17336c55d8928c Honghui Zhang 2016-06-08 451
ad9b10e533f6fb3 Yong Wu 2022-05-03 452 static struct iommu_device *mtk_iommu_v1_probe_device(struct device *dev)
b17336c55d8928c Honghui Zhang 2016-06-08 453 {
a9bf2eec5a6fc01 Joerg Roedel 2018-11-29 454 struct iommu_fwspec *fwspec = dev_iommu_fwspec_get(dev);
b17336c55d8928c Honghui Zhang 2016-06-08 455 struct of_phandle_args iommu_spec;
ad9b10e533f6fb3 Yong Wu 2022-05-03 456 struct mtk_iommu_v1_data *data;
635319a4a7444ca Yong Wu 2022-01-17 457 int err, idx = 0, larbid, larbidx;
635319a4a7444ca Yong Wu 2022-01-17 458 struct device_link *link;
635319a4a7444ca Yong Wu 2022-01-17 459 struct device *larbdev;
b17336c55d8928c Honghui Zhang 2016-06-08 460
822a2ed8c606caf Yong Wu 2022-01-17 461 /*
822a2ed8c606caf Yong Wu 2022-01-17 462 * In the deferred case, free the existed fwspec.
822a2ed8c606caf Yong Wu 2022-01-17 463 * Always initialize the fwspec internally.
822a2ed8c606caf Yong Wu 2022-01-17 464 */
822a2ed8c606caf Yong Wu 2022-01-17 @465 if (fwspec) {
822a2ed8c606caf Yong Wu 2022-01-17 466 iommu_fwspec_free(dev);
822a2ed8c606caf Yong Wu 2022-01-17 467 fwspec = dev_iommu_fwspec_get(dev);
822a2ed8c606caf Yong Wu 2022-01-17 468 }
822a2ed8c606caf Yong Wu 2022-01-17 469
f90a9a85fb946e1 Yong Wu 2021-04-12 470 while (!of_parse_phandle_with_args(dev->of_node, "iommus",
f90a9a85fb946e1 Yong Wu 2021-04-12 471 "#iommu-cells",
f90a9a85fb946e1 Yong Wu 2021-04-12 472 idx, &iommu_spec)) {
b17336c55d8928c Honghui Zhang 2016-06-08 473
ad9b10e533f6fb3 Yong Wu 2022-05-03 474 err = mtk_iommu_v1_create_mapping(dev, &iommu_spec);
f90a9a85fb946e1 Yong Wu 2021-04-12 475 of_node_put(iommu_spec.np);
f90a9a85fb946e1 Yong Wu 2021-04-12 476 if (err)
f90a9a85fb946e1 Yong Wu 2021-04-12 477 return ERR_PTR(err);
da5d2748e4a4512 Joerg Roedel 2019-01-23 478
da5d2748e4a4512 Joerg Roedel 2019-01-23 479 /* dev->iommu_fwspec might have changed */
da5d2748e4a4512 Joerg Roedel 2019-01-23 480 fwspec = dev_iommu_fwspec_get(dev);
f90a9a85fb946e1 Yong Wu 2021-04-12 481 idx++;
b17336c55d8928c Honghui Zhang 2016-06-08 482 }
b17336c55d8928c Honghui Zhang 2016-06-08 483
57dbf81f50c82a0 Joerg Roedel 2020-04-29 484 data = dev_iommu_priv_get(dev);
b17336c55d8928c Honghui Zhang 2016-06-08 485
635319a4a7444ca Yong Wu 2022-01-17 486 /* Link the consumer device with the smi-larb device(supplier) */
635319a4a7444ca Yong Wu 2022-01-17 @487 larbid = mt2701_m4u_to_larb(fwspec->ids[0]);
de78657e16f4141 Miles Chen 2022-05-05 488 if (larbid >= MT2701_LARB_NR_MAX)
de78657e16f4141 Miles Chen 2022-05-05 489 return ERR_PTR(-EINVAL);
de78657e16f4141 Miles Chen 2022-05-05 490
635319a4a7444ca Yong Wu 2022-01-17 491 for (idx = 1; idx < fwspec->num_ids; idx++) {
635319a4a7444ca Yong Wu 2022-01-17 492 larbidx = mt2701_m4u_to_larb(fwspec->ids[idx]);
635319a4a7444ca Yong Wu 2022-01-17 493 if (larbid != larbidx) {
635319a4a7444ca Yong Wu 2022-01-17 494 dev_err(dev, "Can only use one larb. Fail@larb%d-%d.\n",
635319a4a7444ca Yong Wu 2022-01-17 495 larbid, larbidx);
635319a4a7444ca Yong Wu 2022-01-17 496 return ERR_PTR(-EINVAL);
635319a4a7444ca Yong Wu 2022-01-17 497 }
635319a4a7444ca Yong Wu 2022-01-17 498 }
635319a4a7444ca Yong Wu 2022-01-17 499
635319a4a7444ca Yong Wu 2022-01-17 500 larbdev = data->larb_imu[larbid].dev;
de78657e16f4141 Miles Chen 2022-05-05 501 if (!larbdev)
de78657e16f4141 Miles Chen 2022-05-05 502 return ERR_PTR(-EINVAL);
de78657e16f4141 Miles Chen 2022-05-05 503
635319a4a7444ca Yong Wu 2022-01-17 504 link = device_link_add(dev, larbdev,
635319a4a7444ca Yong Wu 2022-01-17 505 DL_FLAG_PM_RUNTIME | DL_FLAG_STATELESS);
635319a4a7444ca Yong Wu 2022-01-17 506 if (!link)
635319a4a7444ca Yong Wu 2022-01-17 507 dev_err(dev, "Unable to link %s\n", dev_name(larbdev));
635319a4a7444ca Yong Wu 2022-01-17 508
57dbf81f50c82a0 Joerg Roedel 2020-04-29 509 return &data->iommu;
57dbf81f50c82a0 Joerg Roedel 2020-04-29 510 }
57dbf81f50c82a0 Joerg Roedel 2020-04-29 511
:::::: The code at line 487 was first introduced by commit
:::::: 635319a4a7444ca97124d781cd96deb277ff4d40 media: iommu/mediatek: Add device_link between the consumer and the larb devices
:::::: TO: Yong Wu <yong.wu@mediatek.com>
:::::: CC: Mauro Carvalho Chehab <mchehab@kernel.org>
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
next reply other threads:[~2024-10-17 1:14 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-17 1:14 kernel test robot [this message]
-- strict thread matches above, loose matches on Subject: below --
2024-10-18 0:29 drivers/iommu/mtk_iommu_v1.c:487 mtk_iommu_v1_probe_device() error: we previously assumed 'fwspec' could be null (see line 465) kernel test robot
2024-10-19 0:26 kernel test robot
2024-10-20 5:41 kernel test robot
2024-12-20 21:48 kernel test robot
2024-12-22 10:47 kernel test robot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=202410170948.gfVfAuei-lkp@intel.com \
--to=lkp@intel.com \
--cc=error27@gmail.com \
--cc=oe-kbuild@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.