All of lore.kernel.org
 help / color / mirror / Atom feed
From: Will Deacon <will@kernel.org>
To: Mark Salter <msalter@redhat.com>
Cc: Mark Rutland <mark.rutland@arm.com>,
	Khuong Dinh <khuong@os.amperecomputing.com>,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] drivers/perf: xgene_pmu: Fix uninitialized resource struct
Date: Mon, 14 Sep 2020 12:28:04 +0100	[thread overview]
Message-ID: <20200914112803.GA24312@willie-the-truck> (raw)
In-Reply-To: <20200913174536.207265-1-msalter@redhat.com>

On Sun, Sep 13, 2020 at 01:45:36PM -0400, Mark Salter wrote:
> @@ -1483,11 +1473,23 @@ xgene_pmu_dev_ctx *acpi_get_pmu_hw_inf(struct xgene_pmu *xgene_pmu,
>  		return NULL;
>  
>  	INIT_LIST_HEAD(&resource_list);
> -	rc = acpi_dev_get_resources(adev, &resource_list,
> -				    acpi_pmu_dev_add_resource, &res);
> +	rc = acpi_dev_get_resources(adev, &resource_list, NULL, NULL);
> +	if (rc <= 0) {
> +		dev_err(dev, "PMU type %d: No resources found\n", type);
> +		return NULL;
> +	}
> +
> +	list_for_each_entry(rentry, &resource_list, node) {
> +		if (resource_type(rentry->res) == IORESOURCE_MEM) {
> +			res = *rentry->res;
> +			rentry = NULL;
> +			break;
> +		}
> +	}
>  	acpi_dev_free_resource_list(&resource_list);
> -	if (rc < 0) {
> -		dev_err(dev, "PMU type %d: No resource address found\n", type);
> +
> +	if (rentry) {

I'm curious as to why you've had to change the failure logic here, setting
rentry to NULL instead of checking 'rentry->res' like the TX2 driver (which
I don't immediately understand at first glance).

Will

WARNING: multiple messages have this Message-ID (diff)
From: Will Deacon <will@kernel.org>
To: Mark Salter <msalter@redhat.com>
Cc: Mark Rutland <mark.rutland@arm.com>,
	Khuong Dinh <khuong@os.amperecomputing.com>,
	linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v2] drivers/perf: xgene_pmu: Fix uninitialized resource struct
Date: Mon, 14 Sep 2020 12:28:04 +0100	[thread overview]
Message-ID: <20200914112803.GA24312@willie-the-truck> (raw)
In-Reply-To: <20200913174536.207265-1-msalter@redhat.com>

On Sun, Sep 13, 2020 at 01:45:36PM -0400, Mark Salter wrote:
> @@ -1483,11 +1473,23 @@ xgene_pmu_dev_ctx *acpi_get_pmu_hw_inf(struct xgene_pmu *xgene_pmu,
>  		return NULL;
>  
>  	INIT_LIST_HEAD(&resource_list);
> -	rc = acpi_dev_get_resources(adev, &resource_list,
> -				    acpi_pmu_dev_add_resource, &res);
> +	rc = acpi_dev_get_resources(adev, &resource_list, NULL, NULL);
> +	if (rc <= 0) {
> +		dev_err(dev, "PMU type %d: No resources found\n", type);
> +		return NULL;
> +	}
> +
> +	list_for_each_entry(rentry, &resource_list, node) {
> +		if (resource_type(rentry->res) == IORESOURCE_MEM) {
> +			res = *rentry->res;
> +			rentry = NULL;
> +			break;
> +		}
> +	}
>  	acpi_dev_free_resource_list(&resource_list);
> -	if (rc < 0) {
> -		dev_err(dev, "PMU type %d: No resource address found\n", type);
> +
> +	if (rentry) {

I'm curious as to why you've had to change the failure logic here, setting
rentry to NULL instead of checking 'rentry->res' like the TX2 driver (which
I don't immediately understand at first glance).

Will

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2020-09-14 11:32 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-13 17:45 [PATCH v2] drivers/perf: xgene_pmu: Fix uninitialized resource struct Mark Salter
2020-09-13 17:45 ` Mark Salter
2020-09-14 11:28 ` Will Deacon [this message]
2020-09-14 11:28   ` Will Deacon
2020-09-14 13:13   ` Mark Salter
2020-09-14 13:13     ` Mark Salter
2020-09-14 13:59     ` Will Deacon
2020-09-14 13:59       ` Will Deacon

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=20200914112803.GA24312@willie-the-truck \
    --to=will@kernel.org \
    --cc=khuong@os.amperecomputing.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=msalter@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.