mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Barebox List <barebox@lists.infradead.org>
Subject: [PATCH] drivers: firmware: arm-scmi: Fix iterating over idr
Date: Mon,  4 Dec 2023 08:28:51 +0100	[thread overview]
Message-ID: <20231204072851.2515319-1-s.hauer@pengutronix.de> (raw)

The iterator in idr_for_each_entry() is the pointer we store in the idr,
not the idr element itself.

Fixes: d28d3d9159 ("include: linux/idr.h: implement more Linux API")
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 drivers/firmware/arm_scmi/driver.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/firmware/arm_scmi/driver.c b/drivers/firmware/arm_scmi/driver.c
index 98f6727465..19fb77f4ea 100644
--- a/drivers/firmware/arm_scmi/driver.c
+++ b/drivers/firmware/arm_scmi/driver.c
@@ -990,9 +990,9 @@ int scmi_protocol_device_request(const struct scmi_device_id *id_table)
 {
 	int id, ret = 0;
 	struct list_head *phead = NULL;
+	struct list_head *head;
 	struct scmi_requested_dev *rdev;
 	struct scmi_info *info;
-	struct idr *idr;
 
 	pr_debug("Requesting SCMI device (%s) for protocol 0x%x\n",
 		 id_table->name, id_table->protocol_id);
@@ -1001,8 +1001,7 @@ int scmi_protocol_device_request(const struct scmi_device_id *id_table)
 	 * Search for the matching protocol rdev list and then search
 	 * of any existent equally named device...fails if any duplicate found.
 	 */
-	idr_for_each_entry(&scmi_requested_devices, idr, id) {
-		struct list_head *head = idr->ptr;
+	idr_for_each_entry(&scmi_requested_devices, head, id) {
 		if (!phead) {
 			/* A list found registered in the IDR is never empty */
 			rdev = list_first_entry(head, struct scmi_requested_dev,
-- 
2.39.2




             reply	other threads:[~2023-12-04  7:30 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-04  7:28 Sascha Hauer [this message]
2023-12-04  9:06 ` Ahmad Fatoum

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=20231204072851.2515319-1-s.hauer@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /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