* Re: [PATCH] scsi: ufs: core: Fix link error when CONFIG_RPMB=m
[not found] <20251130151508.3076994-1-beanhuo@iokpp.de>
@ 2025-12-03 6:15 ` kernel test robot
2025-12-03 14:39 ` Arnd Bergmann
0 siblings, 1 reply; 4+ messages in thread
From: kernel test robot @ 2025-12-03 6:15 UTC (permalink / raw)
To: Bean Huo, avri.altman, bvanassche, alim.akhtar, jejb,
martin.petersen, can.guo, beanhuo
Cc: llvm, oe-kbuild-all, linux-scsi, linux-kernel, kernel test robot
Hi Bean,
kernel test robot noticed the following build errors:
[auto build test ERROR on mkp-scsi/for-next]
[also build test ERROR on jejb-scsi/for-next mkp-scsi/6.19/scsi-queue next-20251202]
[cannot apply to linus/master v6.18]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Bean-Huo/scsi-ufs-core-Fix-link-error-when-CONFIG_RPMB-m/20251130-231759
base: https://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git for-next
patch link: https://lore.kernel.org/r/20251130151508.3076994-1-beanhuo%40iokpp.de
patch subject: [PATCH] scsi: ufs: core: Fix link error when CONFIG_RPMB=m
config: loongarch-allmodconfig (https://download.01.org/0day-ci/archive/20251203/202512031316.SvDwnvhy-lkp@intel.com/config)
compiler: clang version 19.1.7 (https://github.com/llvm/llvm-project cd708029e0b2869e80abe31ddb175f7c35361f90)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20251203/202512031316.SvDwnvhy-lkp@intel.com/reproduce)
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>
| Closes: https://lore.kernel.org/oe-kbuild-all/202512031316.SvDwnvhy-lkp@intel.com/
All errors (new ones prefixed by >>):
>> drivers/ufs/core/ufs-rpmb.c:135:5: error: redefinition of 'ufs_rpmb_probe'
135 | int ufs_rpmb_probe(struct ufs_hba *hba)
| ^
drivers/ufs/core/ufshcd-priv.h:445:19: note: previous definition is here
445 | static inline int ufs_rpmb_probe(struct ufs_hba *hba)
| ^
>> drivers/ufs/core/ufs-rpmb.c:234:6: error: redefinition of 'ufs_rpmb_remove'
234 | void ufs_rpmb_remove(struct ufs_hba *hba)
| ^
drivers/ufs/core/ufshcd-priv.h:449:20: note: previous definition is here
449 | static inline void ufs_rpmb_remove(struct ufs_hba *hba)
| ^
2 errors generated.
vim +/ufs_rpmb_probe +135 drivers/ufs/core/ufs-rpmb.c
b06b8c421485e0 Bean Huo 2025-11-08 133
b06b8c421485e0 Bean Huo 2025-11-08 134 /* UFS RPMB device registration */
b06b8c421485e0 Bean Huo 2025-11-08 @135 int ufs_rpmb_probe(struct ufs_hba *hba)
b06b8c421485e0 Bean Huo 2025-11-08 136 {
b06b8c421485e0 Bean Huo 2025-11-08 137 struct ufs_rpmb_dev *ufs_rpmb, *it, *tmp;
b06b8c421485e0 Bean Huo 2025-11-08 138 struct rpmb_dev *rdev;
b06b8c421485e0 Bean Huo 2025-11-08 139 char *cid = NULL;
b06b8c421485e0 Bean Huo 2025-11-08 140 int region;
b06b8c421485e0 Bean Huo 2025-11-08 141 u32 cap;
b06b8c421485e0 Bean Huo 2025-11-08 142 int ret;
b06b8c421485e0 Bean Huo 2025-11-08 143
b06b8c421485e0 Bean Huo 2025-11-08 144 if (!hba->ufs_rpmb_wlun || hba->dev_info.b_advanced_rpmb_en) {
b06b8c421485e0 Bean Huo 2025-11-08 145 dev_info(hba->dev, "Skip OP-TEE RPMB registration\n");
b06b8c421485e0 Bean Huo 2025-11-08 146 return -ENODEV;
b06b8c421485e0 Bean Huo 2025-11-08 147 }
b06b8c421485e0 Bean Huo 2025-11-08 148
b06b8c421485e0 Bean Huo 2025-11-08 149 /* Check if device_id is available */
b06b8c421485e0 Bean Huo 2025-11-08 150 if (!hba->dev_info.device_id) {
b06b8c421485e0 Bean Huo 2025-11-08 151 dev_err(hba->dev, "UFS Device ID not available\n");
b06b8c421485e0 Bean Huo 2025-11-08 152 return -EINVAL;
b06b8c421485e0 Bean Huo 2025-11-08 153 }
b06b8c421485e0 Bean Huo 2025-11-08 154
b06b8c421485e0 Bean Huo 2025-11-08 155 INIT_LIST_HEAD(&hba->rpmbs);
b06b8c421485e0 Bean Huo 2025-11-08 156
b06b8c421485e0 Bean Huo 2025-11-08 157 struct rpmb_descr descr = {
b06b8c421485e0 Bean Huo 2025-11-08 158 .type = RPMB_TYPE_UFS,
b06b8c421485e0 Bean Huo 2025-11-08 159 .route_frames = ufs_rpmb_route_frames,
b06b8c421485e0 Bean Huo 2025-11-08 160 .reliable_wr_count = hba->dev_info.rpmb_io_size,
b06b8c421485e0 Bean Huo 2025-11-08 161 };
b06b8c421485e0 Bean Huo 2025-11-08 162
b06b8c421485e0 Bean Huo 2025-11-08 163 for (region = 0; region < ARRAY_SIZE(hba->dev_info.rpmb_region_size); region++) {
b06b8c421485e0 Bean Huo 2025-11-08 164 cap = hba->dev_info.rpmb_region_size[region];
b06b8c421485e0 Bean Huo 2025-11-08 165 if (!cap)
b06b8c421485e0 Bean Huo 2025-11-08 166 continue;
b06b8c421485e0 Bean Huo 2025-11-08 167
b06b8c421485e0 Bean Huo 2025-11-08 168 ufs_rpmb = devm_kzalloc(hba->dev, sizeof(*ufs_rpmb), GFP_KERNEL);
b06b8c421485e0 Bean Huo 2025-11-08 169 if (!ufs_rpmb) {
b06b8c421485e0 Bean Huo 2025-11-08 170 ret = -ENOMEM;
b06b8c421485e0 Bean Huo 2025-11-08 171 goto err_out;
b06b8c421485e0 Bean Huo 2025-11-08 172 }
b06b8c421485e0 Bean Huo 2025-11-08 173
b06b8c421485e0 Bean Huo 2025-11-08 174 ufs_rpmb->hba = hba;
b06b8c421485e0 Bean Huo 2025-11-08 175 ufs_rpmb->dev.parent = &hba->ufs_rpmb_wlun->sdev_gendev;
b06b8c421485e0 Bean Huo 2025-11-08 176 ufs_rpmb->dev.bus = &ufs_rpmb_bus_type;
b06b8c421485e0 Bean Huo 2025-11-08 177 ufs_rpmb->dev.release = ufs_rpmb_device_release;
b06b8c421485e0 Bean Huo 2025-11-08 178 dev_set_name(&ufs_rpmb->dev, "ufs_rpmb%d", region);
b06b8c421485e0 Bean Huo 2025-11-08 179
b06b8c421485e0 Bean Huo 2025-11-08 180 /* Set driver data BEFORE device_register */
b06b8c421485e0 Bean Huo 2025-11-08 181 dev_set_drvdata(&ufs_rpmb->dev, ufs_rpmb);
b06b8c421485e0 Bean Huo 2025-11-08 182
b06b8c421485e0 Bean Huo 2025-11-08 183 ret = device_register(&ufs_rpmb->dev);
b06b8c421485e0 Bean Huo 2025-11-08 184 if (ret) {
b06b8c421485e0 Bean Huo 2025-11-08 185 dev_err(hba->dev, "Failed to register UFS RPMB device %d\n", region);
b06b8c421485e0 Bean Huo 2025-11-08 186 put_device(&ufs_rpmb->dev);
b06b8c421485e0 Bean Huo 2025-11-08 187 goto err_out;
b06b8c421485e0 Bean Huo 2025-11-08 188 }
b06b8c421485e0 Bean Huo 2025-11-08 189
b06b8c421485e0 Bean Huo 2025-11-08 190 /* Create unique ID by appending region number to device_id */
b06b8c421485e0 Bean Huo 2025-11-08 191 cid = kasprintf(GFP_KERNEL, "%s-R%d", hba->dev_info.device_id, region);
b06b8c421485e0 Bean Huo 2025-11-08 192 if (!cid) {
b06b8c421485e0 Bean Huo 2025-11-08 193 device_unregister(&ufs_rpmb->dev);
b06b8c421485e0 Bean Huo 2025-11-08 194 ret = -ENOMEM;
b06b8c421485e0 Bean Huo 2025-11-08 195 goto err_out;
b06b8c421485e0 Bean Huo 2025-11-08 196 }
b06b8c421485e0 Bean Huo 2025-11-08 197
b06b8c421485e0 Bean Huo 2025-11-08 198 descr.dev_id = cid;
b06b8c421485e0 Bean Huo 2025-11-08 199 descr.dev_id_len = strlen(cid);
b06b8c421485e0 Bean Huo 2025-11-08 200 descr.capacity = cap;
b06b8c421485e0 Bean Huo 2025-11-08 201
b06b8c421485e0 Bean Huo 2025-11-08 202 /* Register RPMB device */
b06b8c421485e0 Bean Huo 2025-11-08 203 rdev = rpmb_dev_register(&ufs_rpmb->dev, &descr);
b06b8c421485e0 Bean Huo 2025-11-08 204 if (IS_ERR(rdev)) {
b06b8c421485e0 Bean Huo 2025-11-08 205 dev_err(hba->dev, "Failed to register UFS RPMB device.\n");
b06b8c421485e0 Bean Huo 2025-11-08 206 device_unregister(&ufs_rpmb->dev);
b06b8c421485e0 Bean Huo 2025-11-08 207 ret = PTR_ERR(rdev);
b06b8c421485e0 Bean Huo 2025-11-08 208 goto err_out;
b06b8c421485e0 Bean Huo 2025-11-08 209 }
b06b8c421485e0 Bean Huo 2025-11-08 210
b06b8c421485e0 Bean Huo 2025-11-08 211 kfree(cid);
b06b8c421485e0 Bean Huo 2025-11-08 212 cid = NULL;
b06b8c421485e0 Bean Huo 2025-11-08 213
b06b8c421485e0 Bean Huo 2025-11-08 214 ufs_rpmb->rdev = rdev;
b06b8c421485e0 Bean Huo 2025-11-08 215 ufs_rpmb->region_id = region;
b06b8c421485e0 Bean Huo 2025-11-08 216
b06b8c421485e0 Bean Huo 2025-11-08 217 list_add_tail(&ufs_rpmb->node, &hba->rpmbs);
b06b8c421485e0 Bean Huo 2025-11-08 218
b06b8c421485e0 Bean Huo 2025-11-08 219 dev_info(hba->dev, "UFS RPMB region %d registered (capacity=%u)\n", region, cap);
b06b8c421485e0 Bean Huo 2025-11-08 220 }
b06b8c421485e0 Bean Huo 2025-11-08 221
b06b8c421485e0 Bean Huo 2025-11-08 222 return 0;
b06b8c421485e0 Bean Huo 2025-11-08 223 err_out:
b06b8c421485e0 Bean Huo 2025-11-08 224 kfree(cid);
b06b8c421485e0 Bean Huo 2025-11-08 225 list_for_each_entry_safe(it, tmp, &hba->rpmbs, node) {
b06b8c421485e0 Bean Huo 2025-11-08 226 list_del(&it->node);
b06b8c421485e0 Bean Huo 2025-11-08 227 device_unregister(&it->dev);
b06b8c421485e0 Bean Huo 2025-11-08 228 }
b06b8c421485e0 Bean Huo 2025-11-08 229
b06b8c421485e0 Bean Huo 2025-11-08 230 return ret;
b06b8c421485e0 Bean Huo 2025-11-08 231 }
b06b8c421485e0 Bean Huo 2025-11-08 232
b06b8c421485e0 Bean Huo 2025-11-08 233 /* UFS RPMB remove handler */
b06b8c421485e0 Bean Huo 2025-11-08 @234 void ufs_rpmb_remove(struct ufs_hba *hba)
b06b8c421485e0 Bean Huo 2025-11-08 235 {
b06b8c421485e0 Bean Huo 2025-11-08 236 struct ufs_rpmb_dev *ufs_rpmb, *tmp;
b06b8c421485e0 Bean Huo 2025-11-08 237
b06b8c421485e0 Bean Huo 2025-11-08 238 if (list_empty(&hba->rpmbs))
b06b8c421485e0 Bean Huo 2025-11-08 239 return;
b06b8c421485e0 Bean Huo 2025-11-08 240
b06b8c421485e0 Bean Huo 2025-11-08 241 /* Remove all registered RPMB devices */
b06b8c421485e0 Bean Huo 2025-11-08 242 list_for_each_entry_safe(ufs_rpmb, tmp, &hba->rpmbs, node) {
b06b8c421485e0 Bean Huo 2025-11-08 243 dev_info(hba->dev, "Removing UFS RPMB region %d\n", ufs_rpmb->region_id);
b06b8c421485e0 Bean Huo 2025-11-08 244 /* Remove from list first */
b06b8c421485e0 Bean Huo 2025-11-08 245 list_del(&ufs_rpmb->node);
b06b8c421485e0 Bean Huo 2025-11-08 246 /* Unregister device */
b06b8c421485e0 Bean Huo 2025-11-08 247 device_unregister(&ufs_rpmb->dev);
b06b8c421485e0 Bean Huo 2025-11-08 248 }
b06b8c421485e0 Bean Huo 2025-11-08 249
b06b8c421485e0 Bean Huo 2025-11-08 250 dev_info(hba->dev, "All UFS RPMB devices unregistered\n");
b06b8c421485e0 Bean Huo 2025-11-08 251 }
b06b8c421485e0 Bean Huo 2025-11-08 252
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] scsi: ufs: core: Fix link error when CONFIG_RPMB=m
2025-12-03 6:15 ` [PATCH] scsi: ufs: core: Fix link error when CONFIG_RPMB=m kernel test robot
@ 2025-12-03 14:39 ` Arnd Bergmann
2025-12-03 16:23 ` Bean Huo
0 siblings, 1 reply; 4+ messages in thread
From: Arnd Bergmann @ 2025-12-03 14:39 UTC (permalink / raw)
To: kernel test robot, Bean Huo, avri.altman, Bart Van Assche,
Alim Akhtar, James E.J. Bottomley, Martin K. Petersen, can.guo,
Bean Huo
Cc: llvm, oe-kbuild-all, linux-scsi, linux-kernel
On Wed, Dec 3, 2025, at 07:15, kernel test robot wrote:
>
> All errors (new ones prefixed by >>):
>
>>> drivers/ufs/core/ufs-rpmb.c:135:5: error: redefinition of 'ufs_rpmb_probe'
> 135 | int ufs_rpmb_probe(struct ufs_hba *hba)
> | ^
> drivers/ufs/core/ufshcd-priv.h:445:19: note: previous definition is here
> 445 | static inline int ufs_rpmb_probe(struct ufs_hba *hba)
> | ^
>>> drivers/ufs/core/ufs-rpmb.c:234:6: error: redefinition of 'ufs_rpmb_remove'
The declaration and definitio are inconsistent: the former is inside of
an #ifdef block, the latter is not. I think either way works, but it
needs to be the same for both.
Arnd
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] scsi: ufs: core: Fix link error when CONFIG_RPMB=m
2025-12-03 14:39 ` Arnd Bergmann
@ 2025-12-03 16:23 ` Bean Huo
2025-12-03 20:31 ` Arnd Bergmann
0 siblings, 1 reply; 4+ messages in thread
From: Bean Huo @ 2025-12-03 16:23 UTC (permalink / raw)
To: Arnd Bergmann, kernel test robot, avri.altman, Bart Van Assche,
Alim Akhtar, James E.J. Bottomley, Martin K. Petersen, can.guo,
Bean Huo
Cc: llvm, oe-kbuild-all, linux-scsi, linux-kernel
On Wed, 2025-12-03 at 15:39 +0100, Arnd Bergmann wrote:
> On Wed, Dec 3, 2025, at 07:15, kernel test robot wrote:
> >
> > All errors (new ones prefixed by >>):
> >
> > > > drivers/ufs/core/ufs-rpmb.c:135:5: error: redefinition of
> > > > 'ufs_rpmb_probe'
> > 135 | int ufs_rpmb_probe(struct ufs_hba *hba)
> > | ^
> > drivers/ufs/core/ufshcd-priv.h:445:19: note: previous definition is here
> > 445 | static inline int ufs_rpmb_probe(struct ufs_hba *hba)
> > | ^
> > > > drivers/ufs/core/ufs-rpmb.c:234:6: error: redefinition of
> > > > 'ufs_rpmb_remove'
>
> The declaration and definitio are inconsistent: the former is inside of
> an #ifdef block, the latter is not. I think either way works, but it
> needs to be the same for both.
>
> Arnd
Hi Arnd,
I was reviewing the kernel test robot output regarding the ufs_rpmb_probe and
ufs_rpmb_remove redefinition errors, and I wanted to clarify my understanding
From what I see in the source:
#if IS_ENABLED(CONFIG_RPMB)
int ufs_rpmb_probe(struct ufs_hba *hba);
void ufs_rpmb_remove(struct ufs_hba *hba);
#else
static inline int ufs_rpmb_probe(struct ufs_hba *hba) { return 0; }
static inline void ufs_rpmb_remove(struct ufs_hba *hba) { }
#endif
my understanding is that if CONFIG_RPMB=n, compilation goes into the #else
branch, which emits static inline stubs, so ufs-rpmb.c should not be compiled at
all because of ufshcd-core-$(CONFIG_RPMB) += ufs-rpmb.o in the Makefile.
However, the robot reported redefinition errors, which suggests that the
header’s #else branch is being included while ufs-rpmb.c is also being compiled.
I’m wondering if I’m missing something about the robot’s build logic.
Thanks,
Bean
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] scsi: ufs: core: Fix link error when CONFIG_RPMB=m
2025-12-03 16:23 ` Bean Huo
@ 2025-12-03 20:31 ` Arnd Bergmann
0 siblings, 0 replies; 4+ messages in thread
From: Arnd Bergmann @ 2025-12-03 20:31 UTC (permalink / raw)
To: Bean Huo, kernel test robot, avri.altman, Bart Van Assche,
Alim Akhtar, James E.J. Bottomley, Martin K. Petersen, can.guo,
Bean Huo
Cc: llvm, oe-kbuild-all, linux-scsi, linux-kernel
On Wed, Dec 3, 2025, at 17:23, Bean Huo wrote:
> On Wed, 2025-12-03 at 15:39 +0100, Arnd Bergmann wrote:
>
> However, the robot reported redefinition errors, which suggests that the
> header’s #else branch is being included while ufs-rpmb.c is also being compiled.
>
> I’m wondering if I’m missing something about the robot’s build logic.
>
It took me a while as well, but I found the link to the patch that
was tested now, as this was the one that changed IS_ENABLED()
to IS_BUILTIN(), and that went wrong with CONFIG_RPMB=m.
Arnd
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-12-03 20:32 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20251130151508.3076994-1-beanhuo@iokpp.de>
2025-12-03 6:15 ` [PATCH] scsi: ufs: core: Fix link error when CONFIG_RPMB=m kernel test robot
2025-12-03 14:39 ` Arnd Bergmann
2025-12-03 16:23 ` Bean Huo
2025-12-03 20:31 ` Arnd Bergmann
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox