mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: Sascha Hauer <s.hauer@pengutronix.de>,
	Barebox List <barebox@lists.infradead.org>
Subject: Re: [PATCH] drivers: firmware: arm-scmi: Fix iterating over idr
Date: Mon, 4 Dec 2023 10:06:17 +0100	[thread overview]
Message-ID: <161fba91-6197-455b-9a1d-1f3d64fa4542@pengutronix.de> (raw)
In-Reply-To: <20231204072851.2515319-1-s.hauer@pengutronix.de>

On 04.12.23 08:28, Sascha Hauer wrote:
> 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>

Reviewed-by: Ahmad Fatoum <a.fatoum@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,

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |




      reply	other threads:[~2023-12-04  9:08 UTC|newest]

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

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=161fba91-6197-455b-9a1d-1f3d64fa4542@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=s.hauer@pengutronix.de \
    /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