[PATCH] drivers: firmware: arm-scmi: Fix iterating over idr
Sascha Hauer
s.hauer at pengutronix.de
Sun Dec 3 23:28:51 PST 2023
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 at 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
More information about the barebox
mailing list