Linux SCSI subsystem development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Yixun Lan" <dlan@kernel.org>
Cc: linux-scsi@vger.kernel.org, devicetree@vger.kernel.org,
	robh@kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH v9 2/2] scsi: ufs: spacemit: k3: Add UFS Host Controller driver
Date: Sat, 28 Nov 2026 01:10:44 +0000	[thread overview]
Message-ID: <sashiko-outbox-238396@kernel.org> (raw)
In-Reply-To: <20261128-08-k3-ufs-support-v9-2-d27deb096d1e@kernel.org>

Thank you for your contribution! Sashiko AI review found 3 potential
issues to consider:
- [Low] scsi: ufs: spacemit: incomplete kernel-doc comments in
  ufs-spacemit.c
- [Low] scsi: ufs: spacemit: positive UIC error codes missed by negative
  err checks
- [Low] scsi: ufs: spacemit: unused variant struct, headers, macros, and
  duplicate tag
--

commit d1110f647e4d5741aaea4207a41324cfd65f105b
Author: Yixun Lan <dlan@kernel.org>

scsi: ufs: spacemit: k3: Add UFS Host Controller driver

This commit adds the UFS host controller driver for the SpacemiT K3 SoC,
supporting UFS 2.2, MIPI UniPro v1.61, and M-PHY v3.0.

> diff --git a/drivers/ufs/host/ufs-spacemit.c b/drivers/ufs/host/ufs-spacemit.c
> new file mode 100644
> index 0000000000000..8024b2c1f4381
> --- /dev/null
> +++ b/drivers/ufs/host/ufs-spacemit.c
> @@ -0,0 +1,619 @@

[ ... ]

> +/**
> + * ufs_spacemit_mphy_init
> + * @hba: host controller instance
> + */
> +static int ufs_spacemit_mphy_init(struct ufs_hba *hba)

[Severity: Low]
This kernel-doc comment is missing a short description after the function
name and a Return: section, and ufs_spacemit_init() below is also missing a
Return: section, which causes W=1 and W=2 kernel-doc warnings.

[ ... ]

> +static int ufs_spacemit_link_startup_pre_change(struct ufs_hba *hba)
> +{
> +	u32 value, sys1clk_1us;
> +	int err;
> +
> +	err = ufs_spacemit_mphy_init(hba);
> +	if (err < 0)
> +		return err;
> +
> +	err = ufs_spacemit_uniprov1p6_init(hba);
> +	if (err < 0)
> +		return err;

[Severity: Low]
As reported by Troy Mitchell on v6 [1], ufshcd_dme_get() and
ufshcd_dme_set() return positive 8-bit UIC command result codes
(0x01..0xFF) when a DME command fails at the UniPro layer.

Checking "if (err < 0)" here and after
ufs_spacemit_quirk_host_pa_saveconfigtime() in
ufs_spacemit_apply_dev_quirks() misses those positive error codes and
allows both functions to continue past failed DME operations instead of
aborting early. In addition, ufs_spacemit_pwr_change_notify() ignores the
return value of ufshcd_dme_set() in POST_CHANGE instead of returning it.

[ ... ]

> +/**
> + * ufs_spacemit_init - init phy and prepare clk
> + * @hba: host controller instance
> + */
> +static int ufs_spacemit_init(struct ufs_hba *hba)
> +{
> +	struct device *dev = hba->dev;
> +	struct ufs_spacemit_host *host;
> +	struct reset_control *rst;
> +
> +	host = devm_kzalloc(dev, sizeof(*host), GFP_KERNEL);
> +	if (!host)
> +		return -ENOMEM;
> +
> +	rst = devm_reset_control_get_exclusive_deasserted(dev, NULL);
> +	if (IS_ERR(rst))
> +		return dev_err_probe(dev, PTR_ERR(rst), "Failed to get reset control\n");
> +
> +	host->hba = hba;
> +	ufshcd_set_variant(hba, host);

[Severity: Low]
This isn't a bug, but struct ufs_spacemit_host is allocated and passed to
ufshcd_set_variant() here without ever being retrieved via
ufshcd_get_variant() anywhere in the driver.

Also, drivers/ufs/host/ufs-spacemit.h includes unused headers
(linux/regulator/consumer.h, linux/pm_qos.h, and linux/workqueue.h) and
defines 15 unused macros (UFS_LOCAL_PORT_ID_REG, UFS_PA_ERR_CODE,
UFS_RETRY_TIMER_REG, UFS_CFG1, DEFAULT_CLK_RATE_HZ, BUS_VECTOR_NAME_LEN,
UFS_HW_VER_*, UFS_DME_VS_CORE_CLK_CTRL, UFS_HCLKDIV_REG, and
MPHY_RX_FSM_STATE), and the commit message has a duplicate Tested-by: tag
for Aurelien Jarno.

[1] https://lore.kernel.org/r/DLLQJDEA91FU.18Q1TSX09AUR3@linux.spacemit.com

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261128-08-k3-ufs-support-v9-0-d27deb096d1e@kernel.org?part=2

      reply	other threads:[~2026-11-28  1:10 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-28  0:49 [PATCH v9 0/2] Add UFS Host driver support for SpacemiT K3 SoC Yixun Lan
2026-11-28  0:49 ` [PATCH v9 1/2] scsi: ufs: spacemit: dt-bindings: Add UFS controller for " Yixun Lan
2026-11-28  0:49 ` [PATCH v9 2/2] scsi: ufs: spacemit: k3: Add UFS Host Controller driver Yixun Lan
2026-11-28  1:10   ` sashiko-bot [this message]

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=sashiko-outbox-238396@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dlan@kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=robh@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