[PATCH v10 11/11] iio: adc: qcom-spmi-iadc: Remove regmap R/W wrapper functions
sashiko-bot at kernel.org
sashiko-bot at kernel.org
Tue Jul 7 01:55:41 PDT 2026
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] The reference count of the parent SPMI device obtained via `spmi_find_device_by_of_node()` is never dropped, causing a memory and device reference leak.
- [Low] Type mismatch in `iadc_probe`: returning `ERR_PTR(-ENODEV)` instead of `-ENODEV`.
--
--- Patch [11]: [PATCH v10 11/11] iio: adc: qcom-spmi-iadc: Remove regmap R/W wrapper functions ---
commit 2cc2678cec6d923731a39311dff1c18e6f022adf
Author: AngeloGioacchino Del Regno <angelogioacchino.delregno at collabora.com>
iio: adc: qcom-spmi-iadc: Remove regmap R/W wrapper functions
This commit simplifies the driver by removing custom regmap read/write
wrappers and directly calling the regmap APIs. It also migrates the driver
to register as a SPMI subdevice to handle the base address internally.
> diff --git a/drivers/iio/adc/qcom-spmi-iadc.c b/drivers/iio/adc/qcom-spmi-iadc.c
> index ad66bb92fe19c..84c2bd27367fd 100644
> --- a/drivers/iio/adc/qcom-spmi-iadc.c
> +++ b/drivers/iio/adc/qcom-spmi-iadc.c
[ ... ]
> @@ -511,7 +488,10 @@ static int iadc_probe(struct platform_device *pdev)
> iadc = iio_priv(indio_dev);
> iadc->dev = dev;
>
> - sparent = to_spmi_device(dev->parent);
> + sparent = spmi_find_device_by_of_node(dev->parent->of_node);
[Severity: High]
Does this leak the device reference?
spmi_find_device_by_of_node() returns a device with its reference count
incremented, but it doesn't appear that put_device() is ever called to
release it within iadc_probe() on either the success or error paths.
> + if (!sparent)
> + return ERR_PTR(-ENODEV);
[Severity: Low]
Does this need to return -ENODEV directly instead of using ERR_PTR()?
Since iadc_probe() returns an int, returning ERR_PTR(-ENODEV) causes a type
mismatch and a compiler warning.
> +
> sub_sdev = devm_spmi_subdevice_alloc_and_add(dev, sparent);
> if (IS_ERR(sub_sdev))
> return PTR_ERR(sub_sdev);
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260707083730.33977-1-angelogioacchino.delregno@collabora.com?part=11
More information about the linux-phy
mailing list