From: sashiko-bot@kernel.org
To: "AngeloGioacchino Del Regno" <angelogioacchino.delregno@collabora.com>
Cc: linux-phy@lists.infradead.org, olteanv@gmail.com,
vkoul@kernel.org, neil.armstrong@linaro.org
Subject: Re: [PATCH RESEND v8 07/10] phy: qualcomm: eusb2-repeater: Migrate to devm_spmi_subdevice_alloc_and_add()
Date: Tue, 12 May 2026 06:10:40 +0000 [thread overview]
Message-ID: <20260512061041.21FEFC2BCB0@smtp.kernel.org> (raw)
In-Reply-To: <20260511100805.121432-8-angelogioacchino.delregno@collabora.com>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Medium] Hardcoded -ENODEV error return masks devm_regmap_init_spmi_ext() failure reason.
- [Medium] Redundant NULL check for `sparent` and lack of parent bus type validation.
--
commit 2df6d70edb9e23df116d298eaf4222879e5acb2e
Author: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
phy: qualcomm: eusb2-repeater: Migrate to devm_spmi_subdevice_alloc_and_add()
This commit registers a new SPMI sub-device for the EUSB2 repeater and
initializes its own regmap. This avoids manually adding the register base
address to every read/write call by leveraging the regmap API instead.
> diff --git a/drivers/phy/qualcomm/phy-qcom-eusb2-repeater.c b/drivers/phy/qualcomm/phy-qcom-eusb2-repeater.c
> --- a/drivers/phy/qualcomm/phy-qcom-eusb2-repeater.c
> +++ b/drivers/phy/qualcomm/phy-qcom-eusb2-repeater.c
[ ... ]
> @@ -242,13 +240,23 @@ static const struct phy_ops eusb2_repeater_ops = {
>
> static int eusb2_repeater_probe(struct platform_device *pdev)
> {
[ ... ]
> + if (!dev->parent)
> + return -ENODEV;
> +
[ ... ]
> - rptr->regmap = dev_get_regmap(dev->parent, NULL);
> - if (!rptr->regmap)
> + sparent = to_spmi_device(dev->parent);
> + if (!sparent)
> return -ENODEV;
Since to_spmi_device() is a container_of() wrapper and dev->parent was just
checked for NULL, won't sparent always be non-NULL here?
Also, does this safely verify the parent is actually an SPMI device? If the
driver is instantiated under a non-SPMI parent via an incorrect Device Tree,
could this lead to type confusion and pass an invalid pointer to
devm_spmi_subdevice_alloc_and_add()?
> +
> + sub_sdev = devm_spmi_subdevice_alloc_and_add(dev, sparent);
> + if (IS_ERR(sub_sdev))
> + return PTR_ERR(sub_sdev);
> +
> + ret = device_property_read_u32(dev, "reg", &eusb2_regmap_config.reg_base);
> if (ret < 0)
> return ret;
>
> - rptr->base = res;
> + rptr->regmap = devm_regmap_init_spmi_ext(&sub_sdev->sdev, &eusb2_regmap_config);
> + if (IS_ERR(rptr->regmap))
> + return -ENODEV;
Is it intentional to return a hardcoded -ENODEV here instead of propagating
the actual error code from devm_regmap_init_spmi_ext() using
PTR_ERR(rptr->regmap)? Masking the original error might make debugging
initialization failures more difficult.
>
> ret = eusb2_repeater_init_vregs(rptr);
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260511100805.121432-1-angelogioacchino.delregno@collabora.com?part=7
--
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy
next prev parent reply other threads:[~2026-05-12 6:10 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-11 10:07 [PATCH RESEND v8 00/10] SPMI: Implement sub-devices and migrate drivers AngeloGioacchino Del Regno
2026-05-11 10:07 ` [PATCH RESEND v8 01/10] spmi: Remove redundant dev_name() print in spmi_device_add() AngeloGioacchino Del Regno
2026-05-11 10:07 ` [PATCH RESEND v8 02/10] spmi: Print error status with %pe format AngeloGioacchino Del Regno
2026-05-11 10:07 ` [PATCH RESEND v8 03/10] spmi: Remove unneeded goto in spmi_device_add() error path AngeloGioacchino Del Regno
2026-05-11 10:07 ` [PATCH RESEND v8 04/10] spmi: Implement spmi_subdevice_alloc_and_add() and devm variant AngeloGioacchino Del Regno
2026-05-12 1:57 ` sashiko-bot
2026-05-11 10:08 ` [PATCH RESEND v8 05/10] nvmem: qcom-spmi-sdam: Migrate to devm_spmi_subdevice_alloc_and_add() AngeloGioacchino Del Regno
2026-05-12 4:14 ` sashiko-bot
2026-05-11 10:08 ` [PATCH RESEND v8 06/10] power: reset: qcom-pon: " AngeloGioacchino Del Regno
2026-05-11 10:08 ` [PATCH RESEND v8 07/10] phy: qualcomm: eusb2-repeater: " AngeloGioacchino Del Regno
2026-05-12 6:10 ` sashiko-bot [this message]
2026-05-11 10:08 ` [PATCH RESEND v8 08/10] misc: qcom-coincell: " AngeloGioacchino Del Regno
2026-05-11 10:08 ` [PATCH RESEND v8 09/10] iio: adc: qcom-spmi-iadc: " AngeloGioacchino Del Regno
2026-05-11 10:08 ` [PATCH RESEND v8 10/10] iio: adc: qcom-spmi-iadc: Remove regmap R/W wrapper functions AngeloGioacchino Del Regno
2026-05-11 13:17 ` [PATCH RESEND v8 00/10] SPMI: Implement sub-devices and migrate drivers Jonathan Cameron
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=20260512061041.21FEFC2BCB0@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=angelogioacchino.delregno@collabora.com \
--cc=linux-phy@lists.infradead.org \
--cc=neil.armstrong@linaro.org \
--cc=olteanv@gmail.com \
--cc=sashiko@lists.linux.dev \
--cc=vkoul@kernel.org \
/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