[PATCH v10 08/11] phy: qualcomm: eusb2-repeater: Migrate to devm_spmi_subdevice_alloc_and_add()

sashiko-bot at kernel.org sashiko-bot at kernel.org
Tue Jul 7 01:51:39 PDT 2026


Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Medium] Leak of the SPMI parent device reference obtained from spmi_find_device_by_of_node().
- [Low] Type mismatch causing a build warning/error: returning a pointer from a function with an integer return type.
--

--- Patch [8]: [PATCH v10 08/11] phy: qualcomm: eusb2-repeater: Migrate to devm_spmi_subdevice_alloc_and_add() ---
commit e125fa6d40c28f38023d56b9eb34e9de7e9957fc
Author: AngeloGioacchino Del Regno <angelogioacchino.delregno at collabora.com>

phy: qualcomm: eusb2-repeater: Migrate to devm_spmi_subdevice_alloc_and_add()

This patch modifies the Qualcomm eUSB2 repeater driver to register a new SPMI
sub-device instead of using the parent SPMI device. It initializes a regmap
with this sub-device's specific base address retrieved from the devicetree,
allowing the regmap API to handle the register base address implicitly.

> diff --git a/drivers/phy/qualcomm/phy-qcom-eusb2-repeater.c b/drivers/phy/qualcomm/phy-qcom-eusb2-repeater.c
> index efeec4709a15d..f99152cf59849 100644
> --- a/drivers/phy/qualcomm/phy-qcom-eusb2-repeater.c
> +++ b/drivers/phy/qualcomm/phy-qcom-eusb2-repeater.c
[ ... ]
> @@ -260,15 +268,21 @@ static int eusb2_repeater_probe(struct platform_device *pdev)
>  	if (!rptr->cfg)
>  		return -EINVAL;
>  
> -	rptr->regmap = dev_get_regmap(dev->parent, NULL);
> -	if (!rptr->regmap)
> -		return -ENODEV;
> +	sparent = spmi_find_device_by_of_node(dev->parent->of_node);
> +	if (!sparent)
> +		return ERR_PTR(-ENODEV);

[Severity: Medium]
Does this code leak the device reference returned by
spmi_find_device_by_of_node()?

The function spmi_find_device_by_of_node() increments the reference count of
the returned device, but it appears this reference is never released via
put_device() on either the success or error paths before returning from
eusb2_repeater_probe().

[Severity: Low]
Does this code return a pointer from a function declared to return an int?

The eusb2_repeater_probe() function returns int, but this error path returns
ERR_PTR(-ENODEV), which might cause a type mismatch warning or build failure.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260707083730.33977-1-angelogioacchino.delregno@collabora.com?part=8



More information about the linux-phy mailing list