Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1735567 > unrolled thread

[PATCH] drivers/perf: arm_pmu_acpi: Release memory obtained by kasprintf

Started byArvind Yadav <arvind.yadav.cs@gmail.com>
First post2017-09-20 09:00 +0200
Last post2017-09-22 16:20 +0200
Articles 3 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] drivers/perf: arm_pmu_acpi: Release memory obtained by kasprintf Arvind Yadav <arvind.yadav.cs@gmail.com> - 2017-09-20 09:00 +0200
    Re: [PATCH] drivers/perf: arm_pmu_acpi: Release memory obtained by  kasprintf Will Deacon <will.deacon@arm.com> - 2017-09-22 13:00 +0200
      Re: [PATCH] drivers/perf: arm_pmu_acpi: Release memory obtained by  kasprintf Catalin Marinas <catalin.marinas@arm.com> - 2017-09-22 16:20 +0200

#1735567 — [PATCH] drivers/perf: arm_pmu_acpi: Release memory obtained by kasprintf

FromArvind Yadav <arvind.yadav.cs@gmail.com>
Date2017-09-20 09:00 +0200
Subject[PATCH] drivers/perf: arm_pmu_acpi: Release memory obtained by kasprintf
Message-ID<urH9g-7S7-11@gated-at.bofh.it>
Free memory region, if arm_pmu_acpi_probe is not successful.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
---
 drivers/perf/arm_pmu_acpi.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/perf/arm_pmu_acpi.c b/drivers/perf/arm_pmu_acpi.c
index 0a9b787..3303dd8 100644
--- a/drivers/perf/arm_pmu_acpi.c
+++ b/drivers/perf/arm_pmu_acpi.c
@@ -235,6 +235,7 @@ int arm_pmu_acpi_probe(armpmu_init_fn init_fn)
 		ret = armpmu_register(pmu);
 		if (ret) {
 			pr_warn("Failed to register PMU for CPU%d\n", cpu);
+			kfree(pmu->name);
 			return ret;
 		}
 	}
-- 
1.9.1

[toc] | [next] | [standalone]


#1737404 — Re: [PATCH] drivers/perf: arm_pmu_acpi: Release memory obtained by kasprintf

FromWill Deacon <will.deacon@arm.com>
Date2017-09-22 13:00 +0200
SubjectRe: [PATCH] drivers/perf: arm_pmu_acpi: Release memory obtained by kasprintf
Message-ID<ustQC-56i-7@gated-at.bofh.it>
In reply to#1735567
On Wed, Sep 20, 2017 at 12:26:38PM +0530, Arvind Yadav wrote:
> Free memory region, if arm_pmu_acpi_probe is not successful.
> 
> Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
> ---
>  drivers/perf/arm_pmu_acpi.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/perf/arm_pmu_acpi.c b/drivers/perf/arm_pmu_acpi.c
> index 0a9b787..3303dd8 100644
> --- a/drivers/perf/arm_pmu_acpi.c
> +++ b/drivers/perf/arm_pmu_acpi.c
> @@ -235,6 +235,7 @@ int arm_pmu_acpi_probe(armpmu_init_fn init_fn)
>  		ret = armpmu_register(pmu);
>  		if (ret) {
>  			pr_warn("Failed to register PMU for CPU%d\n", cpu);
> +			kfree(pmu->name);
>  			return ret;
>  		}
>  	}

It's a bit weird that we bail out of the loop on the first failing CPU, but
you've not changed that behaviour so your patch looks fine in isolation:

Acked-by: Will Deacon <will.deacon@arm.com>

Catalin: can you pick this up as a fix, please?

Will

[toc] | [prev] | [next] | [standalone]


#1737528 — Re: [PATCH] drivers/perf: arm_pmu_acpi: Release memory obtained by kasprintf

FromCatalin Marinas <catalin.marinas@arm.com>
Date2017-09-22 16:20 +0200
SubjectRe: [PATCH] drivers/perf: arm_pmu_acpi: Release memory obtained by kasprintf
Message-ID<uswYa-75K-11@gated-at.bofh.it>
In reply to#1737404
On Fri, Sep 22, 2017 at 11:54:06AM +0100, Will Deacon wrote:
> On Wed, Sep 20, 2017 at 12:26:38PM +0530, Arvind Yadav wrote:
> > Free memory region, if arm_pmu_acpi_probe is not successful.
> > 
> > Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
> > ---
> >  drivers/perf/arm_pmu_acpi.c | 1 +
> >  1 file changed, 1 insertion(+)
> > 
> > diff --git a/drivers/perf/arm_pmu_acpi.c b/drivers/perf/arm_pmu_acpi.c
> > index 0a9b787..3303dd8 100644
> > --- a/drivers/perf/arm_pmu_acpi.c
> > +++ b/drivers/perf/arm_pmu_acpi.c
> > @@ -235,6 +235,7 @@ int arm_pmu_acpi_probe(armpmu_init_fn init_fn)
> >  		ret = armpmu_register(pmu);
> >  		if (ret) {
> >  			pr_warn("Failed to register PMU for CPU%d\n", cpu);
> > +			kfree(pmu->name);
> >  			return ret;
> >  		}
> >  	}
> 
> It's a bit weird that we bail out of the loop on the first failing CPU, but
> you've not changed that behaviour so your patch looks fine in isolation:
> 
> Acked-by: Will Deacon <will.deacon@arm.com>
> 
> Catalin: can you pick this up as a fix, please?

Applied. Thanks.

-- 
Catalin

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web