mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jeremy Linton <jeremy.linton@arm.com>
To: Robin Murphy <robin.murphy@arm.com>, rafael@kernel.org
Cc: lvjianmin@loongson.cn, yangyicong@huawei.com,
	lpieralisi@kernel.org, chenhuacai@loongson.cn,
	linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org,
	lenb@kernel.org
Subject: Re: [PATCH] ACPI: scan: Fix DMA range assignment
Date: Tue, 18 Oct 2022 19:41:44 -0500	[thread overview]
Message-ID: <a63cddd8-b9d3-2bd7-1965-8cd974511678@arm.com> (raw)
In-Reply-To: <e94f99cfe09a64c590f009d21c566339117394e2.1666098844.git.robin.murphy@arm.com>

Hi,

On 10/18/22 08:14, Robin Murphy wrote:
> Assigning the device's dma_range_map from the iterator variable after
> the loop means it always points to the empty terminator at the end of
> the map, which is not what we want. Similarly, freeing the iterator on
> error when it points to somwhere in the middle of the allocated array
> won't work either. Fix this.

This fixes the boot problem on both SoC generations of the rpi4+ACPI,

Thanks,

Tested-by: Jeremy Linton <jeremy.linton@arm.com>

> 
> Fixes: bf2ee8d0c385 ("ACPI: scan: Support multiple DMA windows with different offsets")
> Signed-off-by: Robin Murphy <robin.murphy@arm.com>
> ---
>   drivers/acpi/scan.c | 7 ++++---
>   1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
> index 558664d169fc..024cc373a197 100644
> --- a/drivers/acpi/scan.c
> +++ b/drivers/acpi/scan.c
> @@ -1509,9 +1509,12 @@ int acpi_dma_get_range(struct device *dev, const struct bus_dma_region **map)
>   			goto out;
>   		}
>   
> +		*map = r;
> +
>   		list_for_each_entry(rentry, &list, node) {
>   			if (rentry->res->start >= rentry->res->end) {
> -				kfree(r);
> +				kfree(*map);
> +				*map = NULL;
>   				ret = -EINVAL;
>   				dev_dbg(dma_dev, "Invalid DMA regions configuration\n");
>   				goto out;
> @@ -1523,8 +1526,6 @@ int acpi_dma_get_range(struct device *dev, const struct bus_dma_region **map)
>   			r->offset = rentry->offset;
>   			r++;
>   		}
> -
> -		*map = r;
>   	}
>    out:
>   	acpi_dev_free_resource_list(&list);


  parent reply	other threads:[~2022-10-19  0:42 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-18 13:14 Robin Murphy
2022-10-18 13:31 ` Jianmin Lv
2022-10-19  0:41 ` Jeremy Linton [this message]
2022-10-19  2:07 ` Yicong Yang
2022-10-19  8:13 ` Lorenzo Pieralisi
2022-10-19 18:30   ` Rafael J. Wysocki

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=a63cddd8-b9d3-2bd7-1965-8cd974511678@arm.com \
    --to=jeremy.linton@arm.com \
    --cc=chenhuacai@loongson.cn \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lpieralisi@kernel.org \
    --cc=lvjianmin@loongson.cn \
    --cc=rafael@kernel.org \
    --cc=robin.murphy@arm.com \
    --cc=yangyicong@huawei.com \
    /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

all inboxes | Powered by JetHome®