]> git.baikalelectronics.ru Git - kernel.git/commit
drivers/perf: thunderx2_pmu: Fix memory resource error handling
authorMark Salter <msalter@redhat.com>
Tue, 15 Sep 2020 20:41:10 +0000 (16:41 -0400)
committerWill Deacon <will@kernel.org>
Fri, 18 Sep 2020 13:34:51 +0000 (14:34 +0100)
commit121df23cc1599df760aaa0a2a416b7dfa141dd8a
treeaf5dbdb86c20c2dacbf1171c702931cb3b6195e3
parent37491150aa192b767104f17d04cd414e5c8e1e83
drivers/perf: thunderx2_pmu: Fix memory resource error handling

In tx2_uncore_pmu_init_dev(), a call to acpi_dev_get_resources() is used
to create a list _CRS resources which is searched for the device base
address. There is an error check following this:

   if (!rentry->res)
           return NULL

In no case, will rentry->res be NULL, so the test is useless. Even
if the test worked, it comes before the resource list memory is
freed. None of this really matters as long as the ACPI table has
the memory resource. Let's clean it up so that it makes sense and
will give a meaningful error should firmware leave out the memory
resource.

Fixes: b5f24daf9f8a ("drivers/perf: Add Cavium ThunderX2 SoC UNCORE PMU driver")
Signed-off-by: Mark Salter <msalter@redhat.com>
Link: https://lore.kernel.org/r/20200915204110.326138-2-msalter@redhat.com
Signed-off-by: Will Deacon <will@kernel.org>
drivers/perf/thunderx2_pmu.c