Re: [PATCH v2 4/6] iio: humidity: hid-sensor-humidity: use common device for devres
From: Jonathan Cameron <jic23@kernel.org>
Date: 2026-07-02 17:26:12
Also in:
linux-iio, lkml
On Thu, 02 Jul 2026 21:48:01 +0530 Sanjay Chitroda via B4 Relay [off-list ref] wrote:
From: Sanjay Chitroda <redacted> kmemdup() is used for memory that is logically tied to the HID platform device, even though the driver binds into the IIO framework. Using &indio_dev->dev for devres allocations works functionally, but it results in two separate devres ownership trees—one for the HID platform device (pdev) and another for the IIO device (indio_dev). The devres framework is intended to have a single, well-defined parent device. Since the memory originates from HID sensor probing and is not IIO-specific, &pdev->dev is the correct and logical owner. Switch to using the platform device for devm_kmemdup() so that all resources are released deterministically and consistently. Signed-off-by: Sanjay Chitroda <redacted> Tested-by: Zhang Lixu <lixu.zhang@intel.com>
This one is more significant that the formatting change so I'll pick it up now. Note that it does change the context for that formatting change patch which touches the line below this change. So applied by hand to the testing branch of iio.git. Thanks, Jonathan
quoted hunk ↗ jump to hunk
--- drivers/iio/humidity/hid-sensor-humidity.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)diff --git a/drivers/iio/humidity/hid-sensor-humidity.c b/drivers/iio/humidity/hid-sensor-humidity.c index 8dd8bc0b3ba1..b7130eac0394 100644 --- a/drivers/iio/humidity/hid-sensor-humidity.c +++ b/drivers/iio/humidity/hid-sensor-humidity.c@@ -216,7 +216,7 @@ static int hid_humidity_probe(struct platform_device *pdev) if (ret) return ret; - humid_chans = devm_kmemdup(&indio_dev->dev, humidity_channels, + humid_chans = devm_kmemdup(&pdev->dev, humidity_channels, sizeof(humidity_channels), GFP_KERNEL); if (!humid_chans) return -ENOMEM;