mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] drivers: firmware: arm-scmi: Fix iterating over idr
@ 2023-12-04  7:28 Sascha Hauer
  2023-12-04  9:06 ` Ahmad Fatoum
  0 siblings, 1 reply; 2+ messages in thread
From: Sascha Hauer @ 2023-12-04  7:28 UTC (permalink / raw)
  To: Barebox List

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




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-12-04  9:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-04  7:28 [PATCH] drivers: firmware: arm-scmi: Fix iterating over idr Sascha Hauer
2023-12-04  9:06 ` Ahmad Fatoum

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox