lkml.org 
[lkml]   [2020]   [Sep]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2] drivers/perf: xgene_pmu: Fix uninitialized resource struct
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

\
 
 \ /
  Last update: 2020-09-14 13:33    [W:0.067 / U:0.108 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site