Linux SCSI subsystem development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Dmitry Baryshkov" <dmitry.baryshkov@oss.qualcomm.com>
Cc: linux-scsi@vger.kernel.org
Subject: Re: [PATCH] scsi: ufs: rpmb: register and unregister the ufs_rpmb bus
Date: Sun, 20 Sep 2026 14:59:42 +0000	[thread overview]
Message-ID: <20260920145943.6D4431F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260920-fix-ufs-rpmb-v1-1-560b842c589d@oss.qualcomm.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] scsi: ufs: multiple module_init definitions cause linker error in ufshcd-core
--

commit c4238766f6e56be8464c4760e2cccf9cdc5bd928
Author: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>

scsi: ufs: rpmb: register and unregister the ufs_rpmb bus

This patch adds module_init() and module_exit() functions to handle
ufs_rpmb bus registration and unregistration, fixing an issue where
attempting to register RPMB devices fails because the bus is unregistered.

> diff --git a/drivers/ufs/core/ufs-rpmb.c b/drivers/ufs/core/ufs-rpmb.c
> index 50ef63afd5283..8ae917adbc98b 100644
> --- a/drivers/ufs/core/ufs-rpmb.c
> +++ b/drivers/ufs/core/ufs-rpmb.c
[ ... ]
> @@ -275,5 +275,18 @@ void ufs_rpmb_remove(struct ufs_hba *hba)
>  	dev_info(hba->dev, "All UFS RPMB devices unregistered\n");
>  }
>  
> +static int __init ufs_rpmb_init(void)
> +{
> +	return bus_register(&ufs_rpmb_bus_type);
> +}
> +
> +static void __exit ufs_rpmb_exit(void)
> +{
> +	bus_unregister(&ufs_rpmb_bus_type);
> +}
> +
> +module_init(ufs_rpmb_init);
> +module_exit(ufs_rpmb_exit);

[Severity: Low]
Does this cause a build failure when built as a loadable module?

The ufs-rpmb.c file is compiled and linked directly into the composite
ufshcd-core module when CONFIG_SCSI_UFSHCD=m and CONFIG_RPMB are enabled:

drivers/ufs/core/Makefile:
    ufshcd-core-$(CONFIG_RPMB) += ufs-rpmb.o

However, drivers/ufs/core/ufshcd.c already contains the module_init hook
for the ufshcd-core module with module_init(ufshcd_core_init).

Because module_init() expands to a global alias for init_module, combining
multiple object files with their own module_init() declarations into a single
loadable kernel module produces a fatal linker error due to multiple
definitions.

Could the bus registration be handled by calling ufs_rpmb_init() directly
from ufshcd_core_init() instead?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260920-fix-tcpm-vbus-bis-v1-0-bc9a7c72e5d0@oss.qualcomm.com?part=1

  reply	other threads:[~2026-09-20 14:59 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-20 14:50 [PATCH] scsi: ufs: rpmb: register and unregister the ufs_rpmb bus Dmitry Baryshkov
2026-09-20 14:59 ` sashiko-bot [this message]
2026-09-20 17:05 ` Stanley Jhu
2026-09-25 22:36 ` kernel test robot
2026-09-26  1:49 ` 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=20260920145943.6D4431F000FF@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=dmitry.baryshkov@oss.qualcomm.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=sashiko-reviews@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox