Linux Input/HID development
 help / color / mirror / Atom feed
From: Sanjay Chitroda via B4 Relay <devnull+sanjayembeddedse.gmail.com@kernel.org>
To: "Jonathan Cameron" <jic23@kernel.org>,
	"David Lechner" <dlechner@baylibre.com>,
	"Nuno Sá" <nuno.sa@analog.com>,
	"Andy Shevchenko" <andy@kernel.org>,
	"Jiri Kosina" <jikos@kernel.org>,
	"Srinivas Pandruvada" <srinivas.pandruvada@linux.intel.com>
Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org,
	 linux-input@vger.kernel.org,
	Sanjay Chitroda <sanjayembeddedse@gmail.com>
Subject: [PATCH v2 5/6] iio: position: hid-sensor-custom-intel-hinge: use common device for devres
Date: Thu, 02 Jul 2026 21:48:02 +0530	[thread overview]
Message-ID: <20260702-15-jun-hid-iio-alignment-v2-5-b87f01f5efbc@gmail.com> (raw)
In-Reply-To: <20260702-15-jun-hid-iio-alignment-v2-0-b87f01f5efbc@gmail.com>

From: Sanjay Chitroda <sanjayembeddedse@gmail.com>

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>
---
 drivers/iio/position/hid-sensor-custom-intel-hinge.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iio/position/hid-sensor-custom-intel-hinge.c b/drivers/iio/position/hid-sensor-custom-intel-hinge.c
index 1f4a40716c3f..eb6c59f81c3f 100644
--- a/drivers/iio/position/hid-sensor-custom-intel-hinge.c
+++ b/drivers/iio/position/hid-sensor-custom-intel-hinge.c
@@ -293,7 +293,7 @@ static int hid_hinge_probe(struct platform_device *pdev)
 	}
 
 	indio_dev->num_channels = ARRAY_SIZE(hinge_channels);
-	indio_dev->channels = devm_kmemdup(&indio_dev->dev, hinge_channels,
+	indio_dev->channels = devm_kmemdup(&pdev->dev, hinge_channels,
 					   sizeof(hinge_channels), GFP_KERNEL);
 	if (!indio_dev->channels)
 		return -ENOMEM;

-- 
2.34.1



  parent reply	other threads:[~2026-07-02 16:18 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-02 16:17 [PATCH v2 0/6] HID: iio: warning clean up and prefer kernel coding style Sanjay Chitroda via B4 Relay
2026-07-02 16:17 ` [PATCH v2 1/6] iio: hid-sensors: add/remove blank line Sanjay Chitroda via B4 Relay
2026-07-02 17:30   ` Jonathan Cameron
2026-07-02 16:17 ` [PATCH v2 2/6] iio: hid-sensors: align function parenthesis for readability Sanjay Chitroda via B4 Relay
2026-07-02 17:20   ` Jonathan Cameron
2026-07-03 12:52     ` Andy Shevchenko
2026-07-04  1:09       ` srinivas pandruvada
2026-07-02 16:18 ` [PATCH v2 3/6] iio: hid-sensors: Use implicit NULL pointer checks Sanjay Chitroda via B4 Relay
2026-07-02 17:22   ` Jonathan Cameron
2026-07-02 16:18 ` [PATCH v2 4/6] iio: humidity: hid-sensor-humidity: use common device for devres Sanjay Chitroda via B4 Relay
2026-07-02 17:03   ` sashiko-bot
2026-07-02 17:26   ` Jonathan Cameron
2026-07-02 16:18 ` Sanjay Chitroda via B4 Relay [this message]
2026-07-02 17:18   ` [PATCH v2 5/6] iio: position: hid-sensor-custom-intel-hinge: " sashiko-bot
2026-07-02 17:26   ` Jonathan Cameron
2026-07-02 16:18 ` [PATCH v2 6/6] iio: temperature: hid-sensor-temperature: " Sanjay Chitroda via B4 Relay
2026-07-02 17:28   ` sashiko-bot
2026-07-02 17:29   ` 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=20260702-15-jun-hid-iio-alignment-v2-5-b87f01f5efbc@gmail.com \
    --to=devnull+sanjayembeddedse.gmail.com@kernel.org \
    --cc=andy@kernel.org \
    --cc=dlechner@baylibre.com \
    --cc=jic23@kernel.org \
    --cc=jikos@kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nuno.sa@analog.com \
    --cc=sanjayembeddedse@gmail.com \
    --cc=srinivas.pandruvada@linux.intel.com \
    /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