Re: [PATCH] msi: use for_each_msi_entry_safe iterator macro

From: Lokesh Vutla
Date: Fri Dec 18 2020 - 09:21:35 EST




On 17/12/20 6:25 am, Jacob Keller wrote:
> Commit 81b1e6e6a859 ("platform-msi: Free descriptors in
> platform_msi_domain_free()") introduced for_each_msi_entry_safe as an
> iterator operating on the msi_list using the safe semantics with
> a temporary variable.
>
> A handful of locations still used the generic iterator instead of the
> specific macro. Fix the 3 remaining cases. Add a cocci script which can
> detect and report any misuse that is introduced in future changes.
>
> Cc: Rafael J. Wysocki <rafael@xxxxxxxxxx>
> Cc: Stuart Yoder <stuyoder@xxxxxxxxx>
> Cc: Laurentiu Tudor <laurentiu.tudor@xxxxxxx>
> Cc: Nishanth Menon <nm@xxxxxx>
> Cc: Tero Kristo <t-kristo@xxxxxx>
> Cc: Santosh Shilimkar <ssantosh@xxxxxxxxxx>
> Cc: Miquel Raynal <miquel.raynal@xxxxxxxxxxx>
> Signed-off-by: Jacob Keller <jacob.e.keller@xxxxxxxxx>
> ---

[..snip..]

> }
> diff --git a/drivers/soc/ti/ti_sci_inta_msi.c b/drivers/soc/ti/ti_sci_inta_msi.c
> index 0eb9462f609e..66f9772dcdfa 100644
> --- a/drivers/soc/ti/ti_sci_inta_msi.c
> +++ b/drivers/soc/ti/ti_sci_inta_msi.c
> @@ -64,7 +64,7 @@ static void ti_sci_inta_msi_free_descs(struct device *dev)
> {
> struct msi_desc *desc, *tmp;
>
> - list_for_each_entry_safe(desc, tmp, dev_to_msi_list(dev), list) {
> + for_each_msi_entry_safe(desc, tmp, dev) {
> list_del(&desc->list);
> free_msi_entry(desc);
> }

For ti_sci_inta_msi part:

Reviewed-by: Lokesh Vutla <lokeshvutla@xxxxxx>

Thanks and regards,
Lokesh