diff options
| author | Sanjay Chitroda <sanjayembeddedse@gmail.com> | 2026-07-02 21:48:01 +0530 |
|---|---|---|
| committer | Jonathan Cameron <jic23@kernel.org> | 2026-07-02 18:25:15 +0100 |
| commit | cff496bda5128dd9cf7a38fc2933440ee58b8ad1 (patch) | |
| tree | 6fa13f31af405a8189366e3f828ac96a3f86ee54 | |
| parent | 9da9ee8bea6aa1b699ed93f2dc1a825c148ddbf0 (diff) | |
| download | linux-stable-cff496bda5128dd9cf7a38fc2933440ee58b8ad1.tar.gz linux-stable-cff496bda5128dd9cf7a38fc2933440ee58b8ad1.zip | |
iio: humidity: hid-sensor-humidity: use common device for devres
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 <sanjayembeddedse@gmail.com>
Tested-by: Zhang Lixu <lixu.zhang@intel.com>
Reviewed-by: Maxwell Doose <m32285159@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
| -rw-r--r-- | drivers/iio/humidity/hid-sensor-humidity.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/iio/humidity/hid-sensor-humidity.c b/drivers/iio/humidity/hid-sensor-humidity.c index c376a247b137..1d4612a471db 100644 --- a/drivers/iio/humidity/hid-sensor-humidity.c +++ b/drivers/iio/humidity/hid-sensor-humidity.c @@ -215,7 +215,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; |
